How to Get the Current Page's URL into Flash
This little trick allows a Flash movie (swf) to find out the URL of the page in which it's embedded. After wondering about this for some time, I finally found a blog post with the solution. Here's the key bit of code:
import flash.external.ExternalInterface; var pageURL:String = ExternalInterface.call('window.location.href.toString');
This could be useful if you're using the query string in the URL to keep track of the application's state. However, the solution comes with one caveat: Javascript must be enabled for this to work. The Actionscript 3.0 documentation says that if the window.location.href.toString method doesn't return a value then ExternalInterface.call will return null. Same thing happens when Javascript is disabled.
Here's the original blog post by Abdul Qabiz: How to get URL query-string variables within Flex application


