SwfObject 2.2 Issue When Embedding Multiple SWF’s On A Page

Yesterday and today i had a properly strange issue with SwfObject 2.2.

I wanted to embed 7 swf files in the same html page that would communicate via ExternalInterface using Javascript as a kind of MVC based controller.

I wrote some simple JS code to look for pre-defined div ids and embed each modular swf for my app in place.

Example html and JS is here:

In a nutshell it worked but took ages to finish the embed. So i banged my head against a wall trying all manner of ways to make the embed load quicker, i also tested all the swfobject methods i could but no difference until i realised that a release-build swf from Flex Builder 3 works as expected but a debug-build doesn’t.

You can see from these identical examples how noticeable the difference is:

How strange is that!

If you’re wondering why i use swfobject.createSwf() instead of swfobject.embedSwf() its because createSwf() gives me a decent reference to my flash object and in turn doesn’t require any addition code to work with ExternalInterface in Internet Explorer.

If i use embedSwf() i have to add a Conditional Script Like This to act as a proxy:

You can see the above as a full example here Bobby Vandersluis SwfObject Example

Bobby has some useful demos of the SwfObject features here SwfObject Test Suite

I hope this helps you out, cause it drove me crazy for a good few hours ๐Ÿ˜‰


2 responses to “SwfObject 2.2 Issue When Embedding Multiple SWF’s On A Page

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: