========================================================================
MAIN TIME LINE: LAYER1 FRAME 1 CODE
MAKE 2 BUTTON WITH INSTANCE NAME btn1, btn2
MAKE MOVIE CLIP SYMBOL WITH INSTANCE NAME mc1, mc2
MAKE TEXT BOX WITH INSTANCE NAME scorecounter.text
========================================================================
var score:Number = 0;
var mcArray:Array = new Array(mc1, mc2);
var btnArray:Array = new Array(btn1, btn2);
for(var i:uint = 0; i < mcArray.length; i++) {
btnArray[i].addEventListener(MouseEvent.CLICK, expandInfo);
}
function expandInfo(e:MouseEvent):void {
var index:uint = btnArray.indexOf(e.target);
mcArray[index].visible = false;
score += 1;
scorecounter.text = " SCORE:"+score.toString()
if(score>=2){
this.nextFrame();
scorecounter.text = "TOTAL SCORE:"+score.toString()
}
}
=================================================================================
HOW TRACE BUTTON AND MOVIE INSTANCE NAME FROM ARRAY
=================================================================================
HOW TRACE BUTTON AND MOVIE INSTANCE NAME FROM ARRAY
trace(btnArray[index].name);
trace(mcArray[index].name);
=================================================================================
var btnArray:Array = new Array(btn1,btn2); var mcArray:Array = new Array(mc1,mc2); for(var i:uint = 0; i < mcArray.length; i++) { btnArray[i].addEventListener(MouseEvent.CLICK, expandInfo); } function expandInfo(e:MouseEvent):void { var index:uint = btnArray.indexOf(e.target); mcArray[index].visible = false; trace(btnArray[index].name); trace(mcArray[index].name); }=================================================================================
MAIN TIME LINE: LAYER1 FRAME 2 CODE
MAKE 2 BUTTON WITH INSTANCE NAME Restart_btn, GoStop_btn
MAKE TEXT BOX WITH INSTANCE NAME scorecounter.text
=================================================================================
Restart_btn.addEventListener(MouseEvent.CLICK, goPrev);
function goPrev(e:MouseEvent):void{
this.prevFrame();
}
GoStop_btn.addEventListener(MouseEvent.CLICK, GoStop);
function GoStop(e:MouseEvent):void{
this.gotoAndStop(1);
}
=================================================================================
MAIN TIME LINE: LAYER2 FRAME 1 CODE
stop();
=================================================================================
READ MORE:
=================================================================================
USEFUL IMAGES
EmoticonEmoticon