SWFAddress 2.2 ♥ swfobject 2.0

SWFAddress is the amazingly easy to use solution for deep linking in flash. Once setup its simply a case of calling SWFAddress.setValue("myfolder") to change the browser location bar and using SWFAddress.getValue()to get the current url when SWFAddressEvent.CHANGE is triggered.
In fact SWFAddress is so simple to use that when something goes wrong it hard to find the problem because there are no options to change. The difficulty I ran into recently was when I upgraded to the latest version 2.2 For an inexplicable reason, swfaddress’s SWFAddressEvent.CHANGE would no longer trigger.
I finally isolated the issue to how you include the swfaddress & swfobject javascripts in your html. The order of includes is extremely important. Swfobject must be included before swfaddress, if you using swffit add this after swfaddress. Also you must add a flash id to swfobject’s attributes for embedding. Check out the example below for for SWFAddress 2.2, SWFObject 2 and swffit harmony.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="swfaddress.js"></script>
<script type="text/javascript" src="swffit.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {id:'mainswf'};
swfobject.embedSWF("main.swf", "container", "100%", "100%", "9.0.115","expressInstall.swf", flashvars, params, attributes);
swffit.fit("mainswf", 960, 580);
</script>
</head>
<body>
<div id="container">
</div>
</body>
</html>


See more ,

5 comments ↓

#1 Steven on 11.22.09 at 10:56 am

You’re a lifesaver! My deadline is coming up and I just couldn’t get this to work. Your solution is THE solution.
Swfaddress should put this in their readme files!

#2 Xander on 01.14.10 at 4:55 am

Hi! Very thank you for this explanation, I was trying to match the 3 systems too but not success. I would love to know if this code works fine with the latest versions of the scripts. Thank you very much, great blog also :)

#3 Jloa on 01.29.10 at 9:13 am

I’ve recently finished my new open source lib called SWFSize which is a small (really small) library for Adobe Flash technology that works in collaboration with SWFObject and provides control over the swf’s container metrics. By controlling the swf’s container metrics SWFSize gives you the ability to solve the MAC OS mouse wheel issue once and for all; don’t use workarounds – use the browser’s native scrollbars instead.
You can view the samples/get source/docs at the project’s home page.

Project home: http://chargedweb.com/swfsize/

#4 Nicolas Baptista on 02.27.10 at 7:02 pm

I can say that you saved me from a saturday working night.
Thank you!

#5 biziclop on 05.10.10 at 2:15 pm

Thank you for the id attribute thing — i wouldn’t find it out myself.

Leave a Comment