i have the following for loop within a private constructor in a class:
// Place season choice buttons
for (i = 1; i <= numSeasons; i++) {
thisSeason = setSeasonVar["Season"+i];
var mcName:String = "MC_seasonChoice"+i;
var depthToUse:Number = 1001+i;
var seasonChoiceXPos:Number = 100 + (i*60);
// Add season choice
seasonNavHolder.attachMovie("MC_seasonChoice", mcName, depthToUse, {_x:seasonChoiceXPos, _y:67, txt_seasonChoice:thisSeason});
// Give season choice button actions
seasonNavHolder[mcName].onPress = function():Void {
trace(thisSeason);
}
}
everything works except the “trace(thisSeason)” line of the script. Here, it seems that the script is no longer in the for loop. Each onPress event traces the last value of the array… the last value to be returned from the query and placed into the loadVars object…
is this a scope thing?