SWFObject Deeplinking

Here’s a simple and easy way I was able to link to primary navigation sections in an all flash site.

Basically when you add #video to the end of your URL the blow code will push that video string to a swfobject add variable method. I haven’t tried it yet but I think it would be easy to add a sub section by adding #video/2 or #video/interviews etc. and do a split in the javascript. In the example below the “,0″ is an appended index reference to a sub section within the flash. In my flash if the pageid variable equals “none” then it loads normally.

<div id=“splash”>
       
</div>
<script type=“text/javascript”>
        // <![CDATA[
        var anchor = self.document.location.hash.substring(1);
       
        var section = (anchor == “”) ? “none” : anchor + “,0″;
       
        var so = new SWFObject(“swf/core.swf”, “site”, “990″, “748″, “9″, “#000000″);
        so.addVariable(“pageid”, section); // To deeplink to a section replace “none” with the linkid, for example: “gallery,1″);
        so.write(“splash”);
        // ]]>

</script>

Leave a Reply