SWFObject 2 and SWFAddress

June 23, 2008 · Posted in AS3, Flash, JavaScript 

There seems to be an issue when using SWFObject 2 with SWFAddress; If a movie id is not specified through the optional “attributes” param in the embedSWF method -

swfobject.embedSWF( “main.swf”, “flashcontent”, “700″, “400″, “9″ )

, SWFAddress fails to initialise and generates an error:

B8? is undefined
G()()
swfaddress.js (line 8 ) index2.html()() (line 38) on this error?
if(typeof com==”undefined”){var com={}}i…E]==”id”){SWFAddress.addId(B[E+1])}}}}};

Once I changed it to the following, it worked perfectly:

swfobject.embedSWF( “main.swf”, “flashcontent”, “700″, “400″, “9″, null, {}, {}, {id: ‘main’} );

The docs for SWFAddress doesn’t specify that the ID attribute is required either.
I spent a few hours trying to figure out what I was doing wrong so hopefully this will help someone else to not do the same.

Comments

3 Responses to “SWFObject 2 and SWFAddress”

  1. Koen on November 24th, 2008 10:32 am

    Saved me a lot of time :)

  2. Agra on December 11th, 2008 7:29 am

    Thank you for figuring this out :)

  3. antonio brandao on September 3rd, 2009 9:12 pm

    Adding that “id” parameter was necessary also to make SWFFIT work here

Leave a Reply