I spent a good hour yesterday trying to get SWFAddress 2.1 and SWFObject 2 to work together. First off, they do work together. Second, there's nothing to it. Then why did it take me an hour? Because I'm a dummy and I had the order in which each JavaScript set was called. In hindsight, this is common sense, but the golden ticket here is calling SWFAddress javascript BEFORE declaring the SWFObject. This more applies to people using the dynamic way of embedding the SWFObject. ie:
<head>
<title>SWFObject v2.0 - step 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/swfaddress.js"></script>
<script type="text/javascript">
swfobject.embedSWF('website.swf', 'website', '100%', '100%', '9.0.45',
'swfobject/expressinstall.swf', {}, {bgcolor: '#CCCCCC', menu: 'false'}, {id: 'website'});
</script>
</head>
Silly right? I saw a couple of posts out there of people having a hard time getting this going. Once I flipped the JS declaration, it worked. And I felt kinda dumb. But hey ... That's life.
BTW: both SWFAddress and SWFObject 2 are pretty amazing and should be worked into your site/app flow if they aren't already.



5 Responses to “SWFAddress 2.1 & SWFObject 2 Work Together.”
By Pavel Mickevic on May 21, 2008 | Reply
Ogh…


You were lucky anyway: You spent only good hour. I spent all day, I even have translated all swfaddress.js code into human friendly, debugged that for several hours. I couldnt even think about your discovery
Now I want to shoot myself
Anyway thanks…
By Marc on May 21, 2008 | Reply
hahah .. no doubt.
I think we’ve all been there before. Possibly weekly even.
By Dylan on May 25, 2008 | Reply
Thanks for posting this — you just saved me loads of time.
By Collin on May 27, 2008 | Reply
We’re doing the swfObject2/swfAddress2 thing here too, and we went one further and used swfMacMouseWheel2 too! too.
By Onno on Jul 11, 2008 | Reply
Thanks!!!
It also seems that you have to add this “{id: ‘website’}” attribute to your javascript.
Otherwise the swfaddress won’t work correct, the event dispatched when going back in your browserhistory doesn’t get received in flash…
I don’t understand why though… :/