Well, javascript- and php-free anyway. We'll still need to use actionscript to determine which section we are trying to get to.

For those of you who don't already know, a "deep link" is a link that points to an interior section of a web site (there may be other words for this same idea, this is just how I came to know it). For instance, if your site was www.mysite.com, a deep link on your site might be something like www.mysite.com/products. or mysite.com/portfolio. They are used to allow people to jump to (and bookmark) specific sections of your site without having to go through the homepage and do all that extra clicking.

This particular method involves 3 main steps:
* adding index pages for each section you want to be able to deep link to.
* adding certain attrributes to the object/embed tags of the html page
* adding logic to the actionscript to load a particular section when the site loads

We'll set up the html file first. For this example, lets say you are building mysite.com, and you have your root web site folder already set up with your index.html page, and that html page is holding the main swf file for your site. Now, for this site you want to be able to link to link to the "portfolio" section. What we're going to do is set up a new directory in the root web site folder named "portfolio". Next we will create a copy of your root's index file (the one that is holding your main swf) and place it inside the "portoflio" folder. You'll want to make sure to use an exact copy of your main index file if you are using any javascript (or other language) functions inside the html. When a user comes to your site through this deep link, this will be the main html page they get to. It's a couple of more files on the server as opposed to picking the query string off a url using javascript, but if you're not gonna have that many sections to your site it may be worth it.

Now we are going to make 3 small changes to the object/embed tags. First we will need to change the link to the source swf file, with is sitting one level up from your "portoflio" directory, in the site's root:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="951" height="704" align="top">
<param name="allowScriptAccess" value="sameDomain" />
**<param name="movie" value="../my_site_base.swf" />**
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<embed **realsrc="../my_site_base.swf" src="http://www.actionscript.org/dev/admin/../my_site_base.swf"** width="951" height="704" align="top" quality="high" bgcolor="#000000"  allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


Notice how we simply tell the html page to load the base swf from the parent directory.

Next, we'll set the "BASE" attribute of the object/embed tags. This will tell flash the base URL for relative links inside the flash movie, which more than likely will be intended to be relative to your site's root:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="951" height="704" align="top">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="../my_site_base.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
**<param name="BASE" value="../" />**
<embed realsrc="../my_site_base.swf" src="http://www.actionscript.org/dev/admin/../my_site_base.swf" width="951" height="704" align="top" quality="high" bgcolor="#000000" **BASE="../"** allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


Notice again all we do is point the "BASE" attribute one level up, to the root of the site.

Now the last part for the html. We just add a "FLASHVARS" parameter, which will be the name of the section we want to load when a user comes to this page. FlashVars values will be available on the _root timeline of your flash movie as soon as the swf loads, and that is what we will use in teh AS to determine which section to load. The FlashVars parameter is slightly different than all the others, as it is actually a name/value pair:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="951" height="704" align="top">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="../my_site_base.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
**<param name="FLASHVARS" value="deepLink=portfolio">**
<param name="BASE" value="../" />
<embed realsrc="../my_site_base.swf" src="http://www.actionscript.org/dev/admin/../my_site_base.swf" width="951" height="704" align="top" quality="high" bgcolor="#000000"  **FlashVars="deepLink=portfolio"** BASE="../" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


This particular FlashVars attribute will create a variable named "deepLink" on _root that has a value of "portfolio".

Thats it for the html. Now, when someone hits this particular url (www.mysite.com/portfolio), the index page we just created will load the main swf from the parent directory and set a variable with the name of the section we want to jump to. Now for the actionscript.

As far as my style goes, I usually create a new object and use an init() method to get things rolling. So, on the first frame of my base swf, I would have something like this:

var siteManager:siteManager = new SiteManager(this, _root.deepLink);


notice the _root.deepLink. This is the variable we set in the FlashVars attribute. If this swf loaded into the "portfolio" page, it's value would be "portfolio". If it loaded into the main index page (the one in the root of the site) it would be undefined, since we didnt add a FlashVars attribute to that page. you'll also notice I pass "this" as a parameter to the SiteManager constructor function. I always do that to have a handy reference to the timeline I created that object in.

Now, in my SiteManager class, I would simply test if there has been a value passed in for the deepLink paramter. If there is, I load whatever section that deepLink variable's value is.

(you'll also notice I pass "this" as a parameter to the SiteManager constructor function. I always do that to have a handy reference to the timeline I created that object in).

Obviously the code here is simplified, just to give you a general idea and get you on your way. Now you can just repeat the previous steps of creating a new index page for any other section you want to add a deep link to the site for.

*side note - i learned you can't bold text when using code tags.

class SiteManager {
        private var _tl:MovieClip;
        public function SiteManager (timeline:MovieClip, deepLink:String){
                init(timeline, deepLink)
        }
        private function init(timeline:MovieClip, deepLink:String):Void{
                _tl = timeline;
                if (deepLink)
                switch(deepLink){
                        case "portfolio":
                        //code to load contact section
                        break;
                        case "games":
                        //code to load games section
                        break;
                        default:
                        break;
                }
        }else{
                //load the home section as normal
        }
}
}