views:

547

answers:

1

I have swfaddress (2.4) working fine on my site - the back button works, I can copy and paste urls and be taken to the correct page, etc.

BUT, if I copy a url, say "http://mysite.com/#/bio", and paste it into a new browser window, the site always just loads to the home page after the preloader. What am I missing? Do I somehow need to check the url when the page loads?

A: 

Without seeing any of your code...There's two events you're going to be interested in watching for. When your app starts up you should listen for

SWFAddress.addEventListener(SWFAddressEvent.INIT, __init);

Which would then register the CHANGE listener:

private function __init(event:SWFAddressEvent):void
{
    SWFAddress.addEventListener(SWFAddressEvent.CHANGE, __handle);
}

Your handler function should handle changes in the URL. This will handle the beginning url when it first initializes and when you use SWFAddress.setValue() to change the page:

private function __handle(event:SWFAddressEvent):void
{
    var address:String = SWFAddress.getValue();
    // -- perform actions based on addresss
}
Typeoneerror
Thanks. It seems that just registering for SWFAddressEvent.CHANGE fires the handler, without the need for init.
phil