Like most browser information, this value is most easily retrieved using JavaScript.
Using ExternalInterface, you can call “window.location.href.toString” to retrieve the location of your running Flex application. This method also has the added benefit of returning any query parameters passed into the URL.
Sample code:
|
public function getWindowLocation () : String { var location : String = null; if (ExternalInterface.available) { try { location = ExternalInterface.call (“window.location.href.toString”); } catch (error : Error) { location = null; } } return location; } |

1 comment
Comments feed for this article
January 15, 2009 at 3:57 pm
How to Restrict Your Flex App By Domain « Miscellanea
[...] domain (you’ll notice it takes advantage of the getWindowLocation() method I defined in an earlier post last [...]