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>