SWFAddress and Flash
Flash
If you're unfamiliar with SWFAddress, it's a great library that gives you the ability to have unique URLs for every "page" in a flash website or application that can change on the fly, without a page reload ex: http://www.mediadog.ca/#/work/. SWFAddress also allows for page bookmarking, browser history, and assists you in utilizing the browser's back and forward buttons within a flash application. It's been developed since 2006, and its latest version has plugins available for use with jQuery, Flex, Digg and even YouTube. If this is the first time you've heard of this resource, definitely view some examples on Asual's website: http://www.asual.com/swfaddress/samples/
We've become more familiar with SWFAddress as we've been using it for the past couple versions. If you're comfortable with it, like we are, here are some tips to look into to save some time searching in Google, or testing it out for yourself.
- New in SWFAddress 2.4: Internal and External Change events.
Prior to version 2.4 only the "SWFAddressEvent.CHANGE" event was available. Having only this one event made made it difficult to detect whether the change being broadcasted was from the user interacting with an application directly, or whether they had hit the browser's back and forward buttons. New to version 2.4 are the events "EXTERNAL_CHANGE" and "INTERNAL_CHANGE", which can be a serious time-saver for some scenarios.
- SWFAddress' default tracking functions.
After implementing SWFAddress for the first time, we were baffled when we had discovered that our Google Analytics monitoring for a SWFAddress based website had mysteriously been working correctly without doing anything more than implementing the Google Analytics package into our webpage. This came as much to a surprise to us, as we had anticipated to write some custom code to integrate it properly.
After looking into the SWFAddress Documentation, we discovered that by default both 'urchinTracker' and 'pageTracker._trackPageview' JavaScript methods are automatically invoked on "page" change. In one of our cases, we wanted to add another tracker, along side Google Analytics. To do so, the setTracker() method was used:<script type="text/javascript"><!--
SWFAddress.setTracker(function(){
//Add other trackers here. Note, this method overrides the default, so
//urchinTracker() or pageTracker._trackPageview() must be re-included to
//have them as a functioning tracker if also needed.
pageTracker._trackPageview();
someOtherTracker();
});
// --></script>
- SWFAddress, SWFObject, SWFFit - "Access Denied"?
Depending on your scenario, these are 3 libraries that you may wish to use together on the same webpage. In order to have them working correctly in earlier versions of SWFAddress order of inclusion on your page is key.<!-- SWFObject First! -->
<script src="/blog/js/swfobject.js" type="text/javascript"></script>
<!-- SWFAddress Second! -->
<script src="/blog/js/swfaddress.js" type="text/javascript"></script>
<!-- SWFFit Third! -->
<script src="/blog/js/swffit.js" type="text/javascript"></script>
We believe this issue to be Addressed (pun intended) in newer versions of SWFAddress, although if you happen to experience a random "Access Denied" JavaScript error, this could be your culprit.
If the history of this library is to be anything like the old Flash JavaScript Integration Kit (now the ExternalInterface API), we're sure it won't be long until the features of this great library are inherited into a future release of Flash itself.
For more info check out http://www.asual.com/swfaddress/







About
The Media Dog Media Blog (Say that 3 times fast!) is our place to show you how you can use interactive to drive results for your business, provide inspiration from around the web and update you on the many projects we're working on.