I was looking around for some example code for how to implement full state management in Flash with both functioning back/forward buttons and deeplinking/bookmarking, but couldn’t find any.
So I decided to put together my own and make it available in an attempt to silence the many Flash critics who, rightfully in my opinion, think that it is a major drawback with pure Flash sites.
It’s only tested and working with recent versions of firefox and IE on windows.
Backbutton and bookmarking fails with Opera 8, but deeplinking works.
I’m quite sure someone with decent JS skills should be able to fix that though.
The problem is that “document[movieid].SetVariable();” does not target the swf correctly, which is a mystery to me since I have seen examples using the same syntax that does work.
Another solution would be to rewrite the code to use localConnection instead in which case most browsers should have no problem.
But for now at least you can easily have state management functioning for the very large percentage of users that use FF or IE, and other browsers should hopefully all fail gracefully and be able to follow deeplinks in to your flash site.
So there is no excuse to now implement state management into your Flash site now.
You can try the system with this little ugly example
Please leave a comment if you are using a browser other than FF or IE on windows so I can make a list of what browsers it is working on.
I made a new version using Macromedia JS integration kit for communication between Flash and JS.
Get the download here.
It did not solve the issues with Opera 8.01 apart from getting rid of the JS error, and I doubt that Safari will work still.
So until I get some feedback on how it works with the Browsers that been problematic I’m not sure how much of an improvement it is.
I updated the example above, so try it out and tell me if it’s not working with a particular browser.
So far confirmed to be working is FF 1.0.6 & 1.5 beta1, IE 6, Opera 8.5 and NS8. Not working so far is Opera 8.01