I’m having trouble getting my global variables to work properly. I’m declaring my global’s in an external .as file and I put an include for that .as file on the timeline and then a few frames later, I execute the script for the globals.
So you click the movieclip button, then it plays an animation, then it should load up whatever movieclip button page you clicked. It seems to always play the else statement frame label though, “philadelphiaIN” and the trace comes back undefined…What am I doing wrong?
//Declaration//
stop();
_global.CityVar = "cityhere";
cityAspen.cityfade.city.text = "ASPEN";
cityAspen.onRollOver = over;
cityAspen.onRollOut = out;
cityAspen.onRelease = function() {
_root.gotoAndPlay("start2OUT");
_global.CityVar = "aspen";
trace("aspen");
};
cityAtlanta.cityfade.city.text = "ATLANTA";
cityAtlanta.onRollOver = over;
cityAtlanta.onRollOut = out;
cityAtlanta.onRelease = function() {
_root.gotoAndPlay("start2OUT");
_global.CityVar = "atlanta";
trace("atlanta");
};
//execution//
stop();
if(_global.CityVar == "aspen") {
gotoAndPlay("aspenIN");
trace("load aspen");
} else if(_global.CityVar == "atlanta") {
gotoAndPlay("atlantaIN");
trace("load atlanta");
} else {
gotoAndPlay("philadelphiaIN");
trace(_global.CityVar);
}