Ramblings

April 16, 2008

SWFObject 2.0, SWFAddress 2.1, Flex 3 and getting the starting path

Filed under: deep-linking, flex, swfaddress, swfobject, tip — michaelangela @ 4:19 am

I have a test project running with Flex 3 and SWFAddress 2.1 and SWFObject 1.5. It worked but I noticed that SWFObject was updated to 2.0 and SWFAddress is supposed to work with it. So I upgraded. And getting the first initial URL stopped working. Couldn’t figure it out. Then I saw this:

joeberkovitz.com » UrlKit 0.70 with various fixes and Flex 3 Support on Google Code

One possible caveat is that you must pass a unique object ID to SWFObject for the / tag (this ID is the second arg to the SWFObject constructor). Hope this helps — let me know if you’re still stuck and I’ll try and post something.

In my SWFObject 1.5 code, I wasn’t setting the attributes. SWFObject 2.0 is more strict about it. So after changing this:

var attributes = {};

to this:

var attributes = {};
attributes.id = "content";
attributes.name = "content";

It worked. The actual swfobject call is like so:

swfobject.embedSWF("path/to/app.swf", "content", "100%", "100%", "9.0.0", "path/to/expressinstall.swf", flashvars, params, attributes);

Hope that helps someone out there! Oh yes, thanks to Joe for mentioning the caveat as well. 🙂

Advertisements

2 Comments »

  1. Thank you, thank you, thank you. I’ve been struggling with this for the last hour. After spending 3 hours getting swfaddress to work in the first place!

    After some testing, it turns out that you only need the ID set, not the name.

    Cheers.

    Comment by devstudio — August 14, 2008 @ 11:36 am

  2. No problem. Glad it helped!

    I have to look at the generated script/code to see how it’s actually using the name and id. Thanks for the insight on that bit.

    Comment by michaelangela — August 14, 2008 @ 2:31 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google+ photo

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

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: