as3 adding SWFAddress to existing flash site?

I’m still a newbie in terms of as3, but have built a code-simple flash site (using CS3 & Dreamweaver). I’ve only just discovered SWFAddress / SWFobject / swffit and have been combing through my flash pages to implement these oh-so helpful tools. Troubled process, as it is…

I have literally spent days (not merely hours) trying to adapt various code, watching and following tutorial and trying to adapt what I find for my existing site (which is, unto itself, still in development) - I’m banging my head and pulling out my hair, to be honest… Please help?!

I’m trying to avoid avoid using external packages and script instead on the timeline, in keeping with how the site was originally built (with hopes this would save me from having to rebuild and reorganise the structure of the timeline - there are several gallery pages and files and buttons and cross-linking). But I’ll attach here just one fla (“archives.fla”) that anyone whom has experience with SWFAddress might understand what I’m contending with. I’ve borrowed code from so many sources at this point that the script code is sure to be bungled (one top layer of the fla file, for deep linking).

I would be ever so grateful for assistance in this regard; cannot afford to pass another day trying to figure it out (I am on a deadline)…

----- OPS -----

file to big to attach; i don’t believe looking at the code will be of any use without seeing the set up and references on the timeline… but i’ll insert it anyway (below). is there a way to send the file to someone directly?

thanx in advance…


// this try adapted from main.fla eg, written in downloaded flash file:
http://www.mouseup.me/actionscript-3/flash-swfaddress//

stop();

import SWFAddress;
import SWFAddressEvent;

var pageTextArray:Array=new Array(“Page1”,
“Page2”,
“Page3”);

SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddressChange);
function SWFHandler(EVENT:SWFAddressEvent) {
var address = SWFAddress.getValue();
SWFAddress.setTitle(“archives”+address);
// SWFAddress.setValue(String) is how you set the browser url to change
};

function handleSWFAddressChange(e:SWFAddressEvent) {
trace("SWF Address Value == "+SWFAddress.getValue());

switch(SWFAddress.getValue()){
    case "/":
        archive_btn=pageTextArray[0];
        SWFAddress.setTitle("archives");
    break;
}
        //By using getValue() and a switch statement I am able to determine if 
        //the value is "/" and therefore at the main page

switch(SWFAddress.getParameter("page")){
    case "page1":
        page1_btn=pageTextArray[1];
        SWFAddress.setTitle("archives : 2009to2006");
    break;
    
    case "page2":
        page2_btn=pageTextArray[2];
        SWFAddress.setTitle("archives : 2005to2001");
    break;
    
    case "page3":
        page3_btn=pageTextArray[3];
        SWFAddress.setTitle("archives : 2000to1992");
    break;
}
        //Using getParameter(String) allows me to see what the value of parameters I set are
        //by doing this I am then able to determine what page the user is trying to navigate towards

}

function handleBack(e:MouseEvent):void{
if(SWFAddress.getValue()!=="/"){
SWFAddress.back();
}
// SWFAddress.back() goes to the last URL in browser’s history
// it does not stop when it reaches the home page of your site.

    // NOTE: to prevent the user from going to the site they were on
    // before they reached your site, use a simple if statement that 
    // allows back functionality to work only if the SWFAddress.getValue()
    // is NOT equal to "/"

}

function handleNext(e:MouseEvent):void{
SWFAddress.forward();

// SWFAddress.forward() unlike SWFAddress.back() will  
// NOT cause problems if the user goes to far forward

}

function changePage(p:String):void{
SWFAddress.setValue("?page="+p);
// SWFAddress.setValue(String) is how you set the browser url to change
// In this case “page” is the parameter name and “p” is the value of that parameter
// The parameter name should always be preceded by a “?” then followed
// by an “=” that is then followed by the value of that parameter
}

page1_btn.addEventListener(MouseEvent.CLICK,goPage1);
function goPage1(evt:MouseEvent) {
gotoAndStop(“2009_pg”);
changePage(“page1”);
}

page2_btn.addEventListener(MouseEvent.CLICK,goPage2);
function goPage2(evt:MouseEvent) {
gotoAndStop(“2005_pg”);
changePage(“page2”);
}

page3_btn.addEventListener(MouseEvent.CLICK,goPage3);
function goPage3(evt:MouseEvent) {
gotoAndStop(“2000_pg”);
changePage(“page3”);
}