Javascript library to manage Flash Local Stored Objects

In an earlier post, I explained how to use Javascript to talk to a Flash file to create and read Local stored objects, a.k.a. Flash cookies.

The only hitch I met was that I couldn’t create cross domain cookies this way as I was hitting the same domain policy. However as pointed out in the comments, it is possible, and simple too… I just needed to add…


Well, as I was editing my simple library, I came across a gem of a Javascript library that is better written and was open sourced.
The library can be found on the site,

Couple of points, you should probably use some flash detection when working with this as it uses Actionscript 3.0. This is only available from Flash version 9.0.31. I used‘s most excellent compressed Javascript library.

Depending on your usage of the library, you may need to edit the Javascript to fix a couple of bugs. The library uses document.body.appendChild() which when used while dynamically loading the library, will cause Internet Explorer 7 to calf.

Simple fix is to either use document.write to insert a div into the dom and use this element or use an existing one to append to.

Also found while using dynamic loading, that if there is a timeout caused (from not being able to connect to the Flash file) and the SwfStore object is not initialized, it will throw an error as it tries to access the SwfStore methods.

Another simple fix is to add a check that it is defined…

this._timeout = setTimeout(function () {
            if ( typeof SwfStore!=="undefined" && typeof SwfStore[namespace]!=="undefined" ) {
            	SwfStore[namespace].log('Timeout reached, assuming the store.swf failed to load and firing the onerror callback.');
            	if ( typeof SwfStore[namespace].config.onerror !== "undefined" ){
        }, timeout * 1000);

Anyways, love coming across libraries like this as it saves me a bunch of time. Check it out, it’s almost certainly what you need 🙂

One thought on “Javascript library to manage Flash Local Stored Objects

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s