Tuesday, 19 April 2016

GO TO STOP AS2 AS3



------------------------------------------------------------------------------------------------------------------------
0) MAKE 3 BLAMK KEY FRAMES
1) GIVE LABELS A,B,C
2) KEEP BUTTON BN1 INSTANCE NAME = Bn1 &  IMAGE 
------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
//MAIN TIME LINE FRAME NO:1 CODE
//MAIN TIME LINE FRAME NO:1 CODE
//OR USE gotoAndStop("2");
//OR USE gotoAndStop(2);
stop();
Bn1.addEventListener(MouseEvent.CLICK,Fn1);
function Fn1(event:MouseEvent):void{
gotoAndStop("B");
}
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
//MAIN TIME LINE FRAME NO:2 CODE
//BLUE BORDER BUTTON INSTANCE NAME NextBtn
NextBtn.visible = false;
NextBtn.addEventListener(MouseEvent.CLICK,Fn2); 
function Fn2(event:MouseEvent):void{ 
nextFrame();


var Num1:Number = 0;
CountBtn.addEventListener(MouseEvent.CLICK,AddOne);
function AddOne(e:MouseEvent):void{
Num1++
trace(Num1);
Txt1.text = " SCORE:"+Num1
//WHEN SCORE 5 NEXT BUTTON VISIBLE
if(Num1>=5){
NextBtn.visible = true;
Num1 = 0;
}
}
------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------

//MAIN TIME LINE FRAME NO:3 CODE
//OR USE THIS CODE: gotoAndStop("A"); prevFrame();
//OR USE THIS CODE: gotoAndStop("A"); gotoAndStop("B");
//OR USE THIS CODE: gotoAndStop("1"); gotoAndStop("2");
//OR USE THIS CODE: gotoAndStop(1); gotoAndStop(2); 
Bn2.addEventListener(MouseEvent.CLICK,Fn3);
function Fn3(event:MouseEvent):void{
gotoAndStop("A");
}
PrevBtn.addEventListener(MouseEvent.CLICK,Fn4);
function Fn4(event:MouseEvent):void{
prevFrame();
}








EmoticonEmoticon