Basically I have five mcs on the stage, MC1, MC2, MC3, MC4, MC5, and I would like to change the alpha, for example, each time I click on [COLOR=Blue]nextBtn[/COLOR]. I would control the number of mcs but altering the [COLOR=Blue]if (j <= 4){[/COLOR] line.
var myArray:Array = [“mc”];
var j:int = 1;
nextBtn.addEventListener(MouseEvent.CLICK, onNext);
function onNext(evt:MouseEvent):void {
for (var i:String in myArray){
trace((myArray*) + j);
((myArray*) + j).alpha = .5;
if (j <= 4){
j = j + 1;
} else {
j = 5;
}
}
}
[COLOR=Blue]trace((myArray*) + j);[/COLOR] works just fine, but as soon as I try to do something tangible with it, [COLOR=Blue]((myArray*) + j).alpha = .5;[/COLOR], I get the following error:
[COLOR=Blue]ReferenceError: Error #1056: Cannot create property alpha on String.
at Timeline_Test_fla::MainTimeline/onNext()
[/COLOR]