How do I determine the URL of the current page from within Flex?
+2
A:
I searched and came up with this url. I've honestly never used Flex, but it looks like the important part of that document is this:
private function showURLDetails(e:BrowserChangeEvent):void {
var url:String = browserManager.url;
baseURL = browserManager.base;
fragment = browserManager.fragment;
previousURL = e.lastURL;
fullURL = mx.utils.URLUtil.getFullURL(url, url);
port = mx.utils.URLUtil.getPort(url);
protocol = mx.utils.URLUtil.getProtocol(url);
serverName = mx.utils.URLUtil.getServerName(url);
isSecure = mx.utils.URLUtil.isHttpsURL(url);
}
Either way, good luck! :)
Eric
2009-09-15 04:48:12
+3
A:
Hello,
Using ExternalInterface (flash.external.ExternalInterface
), you can execute Javascript in the browser.
Knowing this, you can call
ExternalInterface.call("window.location.href.toString");
to get the current URL (note that this will be the page url and not the .swf url).
hth
Koen
Koen Weyn
2009-09-15 10:18:42
+5
A:
From the Application:
var myUrl:String = Application.application.url;
jsight
2009-09-16 05:21:29
A:
From the Application, use: this.loaderInfo.loaderURL
to break it apart and use parts of it do:
var splitURL:Array = this.loaderInfo.loaderURL.split('/');
var baseURL:String = "http://"+splitURL[2];
shi11i
2009-09-16 23:49:32