Hi Coders,
I've been trying to get the SWFaddress working in AS 2.0 now for three entire
days, Problem being I'm trying to fire everything off of one frame, my
navigation is made up of like this, it fires to the title, where do I put the
script that invokes the back button occurrence?
// import needed classes (these ship with Flash)
import mx.transitions.Tween;
import mx.transitions.easing.*;
// create menu holder
this.createEmptyMovieClip("mainMenu", 1);
// postion menu based on
mainMenu._x = mainX;
mainMenu._y = mainY;
// Create New XML object
var menuXml:XML = new XML();
menuXml.ignoreWhite = true;
// once loaded lets run the buildMenu function
menuXml.onLoad = buildMenu;
menuXml.load("menu.xml");
// Build Menu
function buildMenu(success:Boolean):Void {
if (success) {
// this is our xml start point
nav = this.firstChild.childNodes;
// we use this var to store the correct _x values for our buttons
var xPos:Number = 0;
// loop through everything in nav
var i:Number;
for (i=0; i<nav.length; i++) {
// attach the button from the libray for each file found
var mainBtn:MovieClip = mainMenu.attachMovie("mainBtn", "mainBtn"+i, i);
// set the text for each button
mainBtn.btnName.t.text = nav[i].attributes.NAME;
// set color of text
textCol = new Color(mainBtn.btnName);
textCol.setRGB(normalColor);
// get the link for each button
mainBtn.link = nav[i].attributes.LINK;
// create a ID for each button for use in our rollover/out effects
mainBtn.ID = i;
// center text - important for the scaling tween
mainBtn.btnName.t.autoSize = "center";
mainBtn.btnName._y -= mainBtn.btnName.t.textHeight/2;
mainBtn.btnName._x -= mainBtn.btnName.t.textWidth/2;
// align each button next to the one before it
xPos += mainBtn.btnName.t.textWidth+buttonSpacing;
mainBtn._x = xPos;
mainBtn.onRelease = mainBtn.onReleaseOutside=function ():Void {
activeMain = this;
// tween color to active color
var currColor = new Color(this.btnName);
col = "0x"+currColor.getRGB().toString(16);
var tweenColor:colorTrans = new colorTrans(this.btnName, colorSpeed);
tweenColor.colorTween(activeColor, col);
// for all other buttons
for (k=0; k<nav.length; k++) {
if (k != this.ID) {
// var used to target each button
var targetName3:String = "mainBtn"+k;
// tween color back to normal - uses the class colorTrans.as
currColor2 = new Color(mainMenu[targetName3].btnName);
col2 = "0x"+currColor2.getRGB().toString(16);
var tweenColor2:colorTrans = new colorTrans(mainMenu[targetName3].btnName,
colorSpeed);
tweenColor2.colorTween(normalColor, col2);
// scale x and y
scale(mainMenu[targetName3], mainMenu[targetName3]._xscale, 100, scaleUpSpeed,
"_xscale", Regular.easeOut);
scale(mainMenu[targetName3],
mainMenu[targetName3]._yscale, 100, scaleUpSpeed, "_yscale", Regular.easeOut);
fade(mainMenu[targetName3],
mainMenu[targetName3]._alpha, 100, scaleUpSpeed, "_alpha", Regular.easeIn);
if(this.ID==0){
SWFAddress.setValue("/about");
mc_MainContainer._x = 95;
mc_MainContainer._y = 186;
mainLoaderContent (this.ID+".swf", mc_MainContainer);
}
if(this.ID==1){
SWFAddress.setValue("/news");
mc_MainContainer._x = 95;
mc_MainContainer._y = 206;
mainLoaderContent (this.ID+".swf", mc_MainContainer);
}
if(this.ID==2){
SWFAddress.setValue("/case_study");
mc_MainContainer._x = 135;
mc_MainContainer._y = 206;
mainLoaderContent (this.ID+".swf", mc_MainContainer);
}
if(this.ID==3){
SWFAddress.setValue("/showcase");
mc_MainContainer._x = mc_MainContainer._x - 14;
mc_MainContainer._y = 186;
mainLoaderContent (this.ID+".swf", mc_MainContainer);
}
if(this.ID==5){
SWFAddress.setValue("/contact");
mc_MainContainer._x = 95;
mc_MainContainer._y = 186;
mainLoaderContent (this.ID+".swf", mc_MainContainer);
}
trace(url);
}
}
};
}
} else {
trace("XML Failed to Load");
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders