------------------------------------------------------------------------------------------------------------------
SHUFFLE ARRAY AS2 CODE:
-------------------------------------------------------------------------------------------------------------------
// MAKE FOUR MOVIE SYMBOLS WITH INSTANCE NAMES MOVIE1,MOVIE2,MOVIE3,MOVIE4
function init(){
myItemArray = new Array("mc1", "mc2", "mc3", "mc4");
var x = 0;
while (x < kCount){
myItemArray[x] = Math.floor(Math.random() * 9) + myItemArray[x];
++x;
}
myItemArray.sort();
var x = 0;
while (x < kCount){
myItemArray[x] = myItemArray[x].substr(1, myItemArray[x].length);
++x;
}
myXArray = new Array(_root.mc1x, _root.mc2x, _root.mc3x, _root.mc4x);
myYArray = new Array(_root.mc1y, _root.mc2y, _root.mc3y, _root.mc4y);
var t = 0;
while (t < kCount){
myElement = eval("_root." + myItemArray[t]);
myElement._x = myXArray[t];
myElement._y = myYArray[t];
myElement._visible = true;
myElement.found = false;
++t;
}
mc1x = _root.mc1._x;
mc1y = _root.mc1._y;
mc2x = _root.mc2._x;
mc2y = _root.mc2._y;
mc3x = _root.mc3._x;
mc3y = _root.mc3._y;
mc4x = _root.mc4._x;
mc4y = _root.mc4._y;
}
kCount = 46;
init();
init();
stop ();
------------------------------------------------------------------------------------------------------------------
SHUFFLE ARRAY AS3 CODE:
-------------------------------------------------------------------------------------------------------------------
/*AS3
Script by Wilson Oh A.K.A Trust me, I'm a programmer
4 June 2012*/
//Store all the front view movie clip inside
var fCards:Array = new Array(mc1, mc2, mc3, mc4, mc5, mc6, mc7, mc8, mc9, mc10, mc11, mc12);
//Store all the back view movie clip inside
//This loop will change their position between each other.
for(var i:int = 0; i < fCards.length; i++)
{
//Use to store data of the random object
var randomNum:Number;
var xPos:Number;
var yPos:Number;
//Get a random number
randomNum = Math.floor(Math.random()*fCards.length);
//Store the randomNum object position
xPos = fCards[randomNum].x;
yPos = fCards[randomNum].y;
//Change between their position
fCards[randomNum].x = fCards[i].x;
fCards[randomNum].y = fCards[i].y;
fCards[i].x = xPos;
fCards[i].y = yPos;
}
---------------------------------------------------------------------------------------------------------------------
Creating a Concentration game in Flash.PDF
http://img2.timg.co.il/forums/58067874.pdf
----------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
// http://img2.timg.co.il/forums/58067874.pdf
//Build an array of the locations of the cards
//I CHANGE THIS LINE BECUSE THIS GIVE ERROR myItemArray[x] = parseInt(Math.random()*9) + myItemArray[x];
//MAKE FOUR MOVIE CLIPS WITH INSTANCE NAMES aONE,aTWO,aTHREE,aFOUR
myItemArray= new Array("aONE", "aTWO", "aTHREE", "aFOUR");
for (var x = 0; x < 12; x++){
myItemArray[x] = Math.floor(Math.random() * 9) + myItemArray[x];
}
//Sort the array
myItemArray.sort();
//Now strip off the random number at the beginning of each item
for (var x = 0; x < 12; x++){
myItemArray[x] = myItemArray[x].substr(1, myItemArray[x].length);
}
// Build an array of x-y coordinates of the cards
myXArray = new Array(_root.aONE._x, _root.aTWO._x, _root.aTHREE._x, _root.aFOUR._x);
myYArray = new Array(_root.aONE._y, _root.aTWO._y, _root.aTHREE._y, _root.aFOUR._y);
//Set the locs of the scrambled array to the locs of the static array of locs
for (var t = 0; t <12; t++){
myElement = eval("_root." + myItemArray[t]);
myElement._x = myXArray[t];
myElement._y = myYArray[t];
}

EmoticonEmoticon