ActionScript3:如何获取放置swf的页面的真实URL?

时间:2010-11-27 17:31:52

标签: flash actionscript-3 mxml flash-builder

所以我试过

            var url:String = String(this.loaderInfo.url);
            var request:URLRequest = new URLRequest(url);
            try {
                navigateToURL(request, '_self'); // second argument is target
            } catch (e:Error) {
                ErrorButton.label = "Please refresh page manually"
            }

            var url:String = String(this.loaderInfo.loaderURL);
            var request:URLRequest = new URLRequest(url);
            try {
                navigateToURL(request, '_self'); // second argument is target
            } catch (e:Error) {
                ErrorButton.label = "Please refresh page manually"
            }

和FlexGlobals.topLevelApplication.url但它们都给出了相同的=(

但是当我有网址http://127.0.0.1/w2/window.swf时,我会回复http://127.0.0.1/w2/window.php?action=read#1。我使用flash builder。那么我该怎样做才能获得真正的完整链接 - 而不是swf链接?

1 个答案:

答案 0 :(得分:7)

怎么样?
var _url:String = flash.external.ExternalInterface.call("window.location");