Ok, this question is quite nooby.
I have a series of buttons that I want to cycle through and make them invisible/visible. My code works perfectly fine for making movie clips invisible, but doesn't seem to work for buttons.
(I have a lot more code, but I'll strip away everything else that's irrelevant. here it is: )
[clarification: checkX and crossX are MovieClips. explanationX is the Button. I tried casting it as a movie (I think), but got the following error message on execution:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MethodInfo-315()
]
ActionScript Code:
CheckAnswers2.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
if(incomplete!=true){
for(i=0; i<5; i++){
var target3:MovieClip = getChildByName("check"+(i+1)) as MovieClip;
var target4:MovieClip = getChildByName("cross"+(i+1)) as MovieClip;
var target7:MovieClip = getChildByName("explanation"+(i+1)) as MovieClip;
target4.visible=true;
target3.visible=false;
target7.visible=true;
}
}
}
);