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

8 Responses to “BrowserHistory AS1 Class and Files”

  1. mason Says:

    Kenny, really nice write up.

  2. byron Says:

    This will really solve a bad problem with Flash apps - I can’t wait to try it out!

  3. Bob Donderwinkel Says:

    Looks nice. Any chance for an AS 2 class version? :)

  4. Kenny Bunch Says:

    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.

  5. Ivan Todorov Says:

    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!

  6. Michaël Says:

    Check this history manager:
    http://zawa-lab.net/blog/index.php?2004/11/18/63-historynav

    All AS2 class. Internal working: iframe + localConnection

    Cheers.

  7. Check Out Says:

    http://maps.yahoo.com/beta/index.php has bookmarking and history management.

  8. Anastasia Preston Says:

    fmgqfj42wtaol6ou

Leave a Reply