gud day to you…
i am creating dis memory game…
i put this code on the 1ST FRAME
stop();
var id:String; //value of card
var selCard1:String; //index for first selected card
var selCard2:String; //index for first selected card
var clickCount:Number = 0; //count number of clicks
i put this inside my 2 MOVIECLIP CARD
CARD1
on (press) {
id = 'onethird';
_root.clickCount++;
this.gotoAndStop(2);
//check if 2 cards are clicked
if (_root.clickCount == 1) {
selCard1 = id;
trace(selCard1);
} else if (_root.clickCount == 2) {
selCard2 = id;
trace(selCard2);
//check cards
if ((selCard1 == onethird) && (selCard2 == onethirdPic)) {
trace("MATCH");
} else {
trace("no");
}
}
}
CARD2
on (press) {
id = 'onethirdPic';
_root.clickCount++;
this.gotoAndStop(2);
//check if 2 cards are clicked
if (_root.clickCount == 1) {
selCard1 = id;
trace( selCard1);
} else if (_root.clickCount == 2) {
selCard2 = id;
trace( selCard2);
//check cards
if ((selCard1 == onethird) && (selCard2 == onethirdPic)) {
trace("MATCH");
} else {
trace("no");
}
}
}
can anyone help me? this codes are working but it can’t detect if my selCard1 and selCard2 are Matched.
i’L try to upload my .fla file
thank you in advance…
cheers!