BrowserHistory AS1 Class and Files
I originally posted my AS1 BrowserHistory class and associated files in 2002 and it was distributed on various sites. In 2005, with my own site, I decided to finally give it a permanent home
What
Normally, pressing a browser’s forward or backward navigation buttons on a Flash page will take you out of the movie. The BrowserHistory class allows developers to create a history list that can trigger actions based on the use of these buttons.
Why
I have noticed a number of solutions out there that attempt to resolve the back button problem, most noteably Robert Penner’s work (www.robertpenner.com) and more recently Mike Chamber’s Pet Store back button. Robert introduced using MX’s LocalConnection object to get around all the browser issues, and I really like the new solutions that implemented this approach, however all of them seem to be missing something. Robert’s required the creation of a new swf and html page for every History object. Mike’s limited you to passing strings through the browser’s url and doing your own data conversions. The javascript approach also didn’t work in the newer Netscape and Mozilla browsers, because appending variables to a url is not treated as a new history object in the browser.
What I really wanted from a History object in Flash was something that:
1) would work on all platforms and browsers with the 6 player
2) would be as simple to use as adding History elements through script and defining a function to handle a history event
3) would only require including extra files and not manipulating them
4) would allow me to work with any predefined datatype
In my attempt, I tried to accomplish these goals by moving the persistant storage of the History elements into a SharedObject instance and using 4 predefined swfs and their accompanying html files (total of 8 files) to create a way of checking status. Since there are only those 8 files used in tracking status, no matter how many history elements you add, a user will only request a total of 8 additional files (this is nice if you think about server loads, the other methods request a file for every history element). Using this method of storage and status does not require the manipulation of extra files, instead all of the work is done “behind the scenes” by the BrowserHistory Class, the only requirements are that you include the proper files and know how to script a BrowserHistory instance.
I hope that this can be of use to someone.
ENJOY ![]()
Kenny Bunch
May 5th, 2005 at 6:44 am
Kenny, really nice write up.
May 5th, 2005 at 10:30 am
This will really solve a bad problem with Flash apps - I can’t wait to try it out!
May 9th, 2005 at 10:34 am
Looks nice. Any chance for an AS 2 class version?
May 9th, 2005 at 10:51 am
Yes. I have one, but I need to clean it up, test a bit to make sure its solid. As soon as I have some time it will be released.
September 29th, 2005 at 11:17 pm
Kenny, great post and a great solution. What we at BLITZ have found extremely challenging is to have browser history along with bookmarking for (deeplinking). What i mean is, as you are browsing your flash website, the URL of the address bar changes, so you can book mark it and when you return to the site - that URL will deeplink directly into the section. We’ve been able to get one or ther other working perfectly independently, but not a solution for both (our goal has been without middleware or frames). If you come accross a good solution, I’d love to learn about it!
November 7th, 2005 at 3:04 pm
Check this history manager:
http://zawa-lab.net/blog/index.php?2004/11/18/63-historynav
All AS2 class. Internal working: iframe + localConnection
Cheers.
November 7th, 2005 at 3:29 pm
http://maps.yahoo.com/beta/index.php has bookmarking and history management.
November 12th, 2008 at 5:28 pm
fmgqfj42wtaol6ou