the array matches the numbers (which unfortunatly places the same pic twice). I need two different pics so If i change the array to [1,5,2,6,3,7,4,8] then it display's the two different pics but won't match them b/c the numbers don't match ..... how do I get around this ?
ActionScript Code:
function ShuffleCards () {
cardArray = new Array();
var startArray = [1, 1, 2, 2, 3, 3, 4, 4];
var placeArray = new Array();
for (a=0; a<startArray.length; a++) {
placeArray.push(a);
}
for (a=0; a<startArray.length; a++) {
do {
trg = random(placeArray.length);
newplace = placeArray[trg];
} while (startArray[a] == startArray[newplace] && a != startArray.length-1);
placeArray.splice(trg, 1);
if (startArray[a] != startArray[newplace]) {
cardArray.push(startArray[newplace]);
} else {
cardArray.unshift(startArray[newplace]);
}
}
}
function CheckNull (checkstring) {
if (checkstring.length<1) {
return (true);
}
if (checkstring == "") {
return (true);
}
if (checkstring == null) {
return (true);
}
return (false);
}
stop ();