MAIN TIMELINE LAYER 1 FRAME NO :1 CODE
-------------------------------------------------------------------------------------------------------------------------
StartBn.onPress=function(){
//AFTER THIS CODE FRAME NO 2
gotoAndStop(2) ;
}
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
MAIN TIMELINE LAYER 1 FRAME NO :2 CODE
1) MAKE 10 FRAMES MOVIE CLIP
2) NEED INSTANCE NAMES
StartBn,ReStartBn,MOVIE,TryAginMc,Txt1,Txt2,Bn1,Bn2,Bn3,Bn4,Bn5,
Bn6,Bn7,Bn8,Bn9,Bn10
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
//http://flashcollege.blogspot.co.uk/2014/12/random-function-in-as3.html
//IF YOU MAKE 10 FRAMES MOVIE CLIP YOU NEED RANDOM NUMBER 11
//OR USE THIS SIMPLE CODE AS2
//AS2 CODE Use ._currentframe
MOVIE.gotoAndStop(Math.round(Math.random()* 11));
trace("Movie Frame No:"+ MOVIE._currentframe)
Txt1.text = String(MOVIE._currentframe);
Bn1.onPress=function(){
if (Txt1.text==1){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn1._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn2.onPress=function(){
if (Txt1.text==2){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn2._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn3.onPress=function(){
if (Txt1.text==3){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn3._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn4.onPress=function(){
if (Txt1.text==4){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn4._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn5.onPress=function(){
if (Txt1.text==5){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn5._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn6.onPress=function(){
if (Txt1.text==6){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn6._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn7.onPress=function(){
if (Txt1.text==7){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn7._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn8.onPress=function(){
if (Txt1.text==8){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn8._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn9.onPress=function(){
if (Txt1.text==9){
MOVIE.nextFrame();
Txt1.text = String(MOVIE._currentframe);
Bn9._visible = false
SCORE++
Txt2.text = " SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
Bn10.onPress=function(){
if (Txt1.text==10){
MOVIE.gotoAndStop(1);
Txt1.text = String(MOVIE._currentframe);
Bn10._visible = false
SCORE++
Txt2.text = "SCORE:"+SCORE.toString();
}
else{
_root.TryAginMc.play();
}
}
var SCORE:Number = 0;
Txt2.text = "SCORE:"+SCORE;
//MAKE BLANK KEY FRAME ON MAIN TIME LINE
//MAKE LAYER NO: 2 ON MAIN TIME LINE
this.onEnterFrame = function(){
if (SCORE==10){
this.nextFrame();
}
}
-------------------------------------------------------------------------------------------------------------------------
MAIN TIMELINE LAYER 1 FRAME NO :3 CODE
-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------
//CONTNET LAYER FRAME NO:2 CODE
ReStartBn.onPress = function() {
//BACK THIS CODE FRAME NO : 1
gotoAndPlay(2);
}
------------------------------------------------------------------------------------------------------------------------
USE FULL IMAGES BY TOOLKIT FOR CREATE JS
SHIFT + F9
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
1 comments:
EmoticonEmoticon