-----------------------------------------------------------------------------------------------------------------------
1- NEED FOUR BMP PICTURES
2- CHANGE PICTURES INTO BUTTON
3-SET BUTTON CLASSES
4-FOR SET CLASSES JUST TICK " Export For ActionScript "
5- COPY AND PASTE CODE IN AB LAYER
6- COPY AND PASTE CODE IN SHUFFLE LAYER
READ MORE:
http://code.tutsplus.com/tutorials/quick-introduction-flash-button-and-label-components--active-5594
DOWNLOAD SOURCE FILE:
http://bit.ly/1AuMh9u
-----------------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE
------------------------------------------------------------------------------------------------------------------
//AB LAYER CODE
bn1.addEventListener(MouseEvent.CLICK,fn1)
function fn1(e:MouseEvent):void{
bn1.label = " A "
trace("A")
bn3.label = " A "
bn4.label = " A "
}
bn2.addEventListener(MouseEvent.CLICK,fn2)
function fn2(e:MouseEvent):void{
bn2.label = " A "
trace("A")
bn3.label = " A "
bn4.label = " A "
}
addEventListener(Event.ENTER_FRAME, fn1fn2);
function fn1fn2(e:Event):void{
if (bn1.label == " A " && bn2.label == " A " ) {
bn1.visible=false;
bn2.visible=false;
}
}
bn3.addEventListener(MouseEvent.CLICK,fn3)
function fn3(e:MouseEvent):void{
bn3.label = " B "
trace("B")
bn1.label = " B "
bn2.label = " B "
}
bn4.addEventListener(MouseEvent.CLICK,fn4)
function fn4(e:MouseEvent):void{
bn4.label = " B "
trace("B")
bn1.label = " B "
bn2.label = " B "
}
addEventListener(Event.ENTER_FRAME, fn3fn4);
function fn3fn4(e:Event):void{
if (bn3.label == " B " && bn4.label == " B " ) {
bn3.visible=false;
bn4.visible=false;
}
}
//SHUFFLE CODE FOR SHUFFLE LAYER
// IN THIS CODE 4 DIGIT USE FOUR PICTURES WHICH WE USE
var MovieArray:Array = new Array(bn1,bn2,bn3,bn4);
for(var i:int = 0; i < 4; i++){
var RandomNumber:Number = Math.floor(Math.random() * (4 - i) );
var MoviePosX:Number = MovieArray[RandomNumber].x;
var MoviePosY:Number = MovieArray[RandomNumber].y;
MovieArray[RandomNumber].x = MovieArray[i].x;
MovieArray[RandomNumber].y = MovieArray[i].y;
MovieArray[i].x = MoviePosX
MovieArray[i].y = MoviePosY
}
----------------------------------------------------------------------------------------------------------------
OR USE THIS CODE WITH LABEL ERASE CODE
---------------------------------------------------------------------------------------------------------------
//AB LAYER CODE
bn1.addEventListener(MouseEvent.CLICK,fn1)
function fn1(e:MouseEvent):void{
bn1.label = " A "
trace("A")
//LABEL ERASE CODE TO RETURN GAME
bn3.label = " "
bn4.label = " "
}
bn2.addEventListener(MouseEvent.CLICK,fn2)
function fn2(e:MouseEvent):void{
bn2.label = " A "
trace("A")
//LABEL ERASE CODE TO RETURN GAME
bn3.label = " "
bn4.label = " "
}
addEventListener(Event.ENTER_FRAME, fn1fn2);
function fn1fn2(e:Event):void{
if (bn1.label == " A " && bn2.label == " A " ) {
bn1.visible=false;
bn2.visible=false;
}
}
bn3.addEventListener(MouseEvent.CLICK,fn3)
function fn3(e:MouseEvent):void{
bn3.label = " B "
trace("B")
//LABEL ERASE CODE TO RETURN GAME
bn1.label = " "
bn2.label = " "
}
bn4.addEventListener(MouseEvent.CLICK,fn4)
function fn4(e:MouseEvent):void{
bn4.label = " B "
trace("B")
//LABEL ERASE CODE TO RETURN GAME
bn1.label = " "
bn2.label = " "
}
addEventListener(Event.ENTER_FRAME, fn3fn4);
function fn3fn4(e:Event):void{
if (bn3.label == " B " && bn4.label == " B " ) {
bn3.visible=false;
bn4.visible=false;
}
}
//SHUFFLE CODE FOR SHUFFLE LAYER
// IN THIS CODE 4 DIGIT USE FOUR PICTURES WHICH WE USE
var MovieArray:Array = new Array(bn1,bn2,bn3,bn4);
for(var i:int = 0; i < 4; i++){
var RandomNumber:Number = Math.floor(Math.random() * (4 - i) );
var MoviePosX:Number = MovieArray[RandomNumber].x;
var MoviePosY:Number = MovieArray[RandomNumber].y;
MovieArray[RandomNumber].x = MovieArray[i].x;
MovieArray[RandomNumber].y = MovieArray[i].y;
MovieArray[i].x = MoviePosX
MovieArray[i].y = MoviePosY
}
--------------------------------------------------------------------------------------------------------------------
UPPER CODE WRITE WITH RESET FUNCTION CODE
MAKE RESET LAYER AND PASTE CODE
DOWNLOAD SOURCE FILE
http://bit.ly/1vaDG9E
---------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE
-------------------------------------------------------------------------------------------------------------------
//AB LAYER CODE
bn1.addEventListener(MouseEvent.CLICK,fn1)
function fn1(e:MouseEvent):void{
bn1.label = " A "
trace("A")
RT1();
}
bn2.addEventListener(MouseEvent.CLICK,fn2)
function fn2(e:MouseEvent):void{
bn2.label = " A "
trace("A")
RT1();
}
addEventListener(Event.ENTER_FRAME, fn1fn2);
function fn1fn2(e:Event):void{
if (bn1.label == " A " && bn2.label == " A " ) {
bn1.visible=false;
bn2.visible=false;
}}
bn3.addEventListener(MouseEvent.CLICK,fn3)
function fn3(e:MouseEvent):void{
bn3.label = " B "
trace("B")
RT2();
}
bn4.addEventListener(MouseEvent.CLICK,fn4)
function fn4(e:MouseEvent):void{
bn4.label = " B "
trace("B")
RT2();
}
addEventListener(Event.ENTER_FRAME, fn3fn4);
function fn3fn4(e:Event):void{
if (bn3.label == " B " && bn4.label == " B " ) {
bn3.visible=false;
bn4.visible=false;
}}
//SHUFFLE CODE FOR SHUFFLE LAYER
// IN THIS CODE 4 DIGIT USE FOUR PICTURES WHICH WE USE
var MovieArray:Array = new Array(bn1,bn2,bn3,bn4);
for(var i:int = 0; i < 4; i++){
var RandomNumber:Number = Math.floor(Math.random() * (4 - i) );
var MoviePosX:Number = MovieArray[RandomNumber].x;
var MoviePosY:Number = MovieArray[RandomNumber].y;
MovieArray[RandomNumber].x = MovieArray[i].x;
MovieArray[RandomNumber].y = MovieArray[i].y;
MovieArray[i].x = MoviePosX
MovieArray[i].y = MoviePosY
}
//RESET CODE FOR RESET LAYER
function RT1() {
bn3.label = " "
bn4.label = " "
}
function RT2() {
bn1.label = " "
bn2.label = " "
}
EmoticonEmoticon