---------------------------------------------------------------------------------------------------------------
STRING MATCHING GAME AS2
1) MAIN LAYER 1 FRAME 1 CODE
----------------------------------------------------------------------------------------------------------------
//ON LAYER NO:1 FRAME NO:1 CODE
stop();
var Num1:String = "RED";
var Num2:String = "RED";
var Num3:String = "GREEN";
var Num4:String = "GREEN";
function RemoveRedButtons(){
if(txt1.text==txt2.text){
btn1._visible=false;
btn2._visible=false;
}}
function RemoveGreenButtons(){
if(txt1.text==txt2.text){
btn3._visible=false;
btn4._visible=false;
}}
//ENTER FRAME FUNTION FOR RETURN GAME
this.onEnterFrame = function(){
if(txt1.text==txt2.text){
txt1.text=""
txt2.text=""
}
if(txt1.text=="GREEN" && txt2.text=="RED"||txt1.text=="RED" && txt2.text=="GREEN" ){
txt1.text=""
txt2.text=""
gotoAndStop(2);
}}
--------------------------------------------------------------------------------------------------------------------
1) MAIN LAYER 1 FRAME 2 TRY BUTTON INSIDE CODE
-------------------------------------------------------------------------------------------------------------------
//INSIDE TRY BUTTON CODE
on(press){
txt1.text=""
txt2.text=""
gotoAndStop(1);
}
----------------------------------------------------------------------------------------------------------------------
MAKE 4 BUTTONS GIVE INSTANCE NAMES btn1, btn2,btn3,btn4
WITH INSERT CODES
MAKE 2 TEXT BOXES GIVE INSTANCE NAMES txt1, txt2
-------------------------------------------------------------------------------------------------------------------
// INSERT btn1 CODE
on(press){
txt1.text = Num1
RemoveRedButtons();
}
// INSERT btn2 CODE
on(press){
txt2.text = Num2
RemoveRedButtons();
}
// INSERT btn3 CODE
on(press){
txt1.text = Num3
RemoveGreenButtons();
}
// INSERT btn4 CODE
on(press){
txt2.text = Num4
RemoveGreenButtons();
}
-------------------------------------------------------------------------------------------------------------------
USEFUL IMAGES
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
EmoticonEmoticon