---------------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN AS2
DOWNLOAD SOURCE:
----------------------------------------------------------------------------------------------------------------------
// MAKE FOUR MOVIE SYMBOLS WITH INSTANCE NAMES MOVIE1,MOVIE2,MOVIE3,MOVIE4
function init(){
myItemArray = new Array("MOVIE1", "MOVIE2", "MOVIE3", "MOVIE4");
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.MOVIE1x, _root.MOVIE2x, _root.MOVIE3x, _root.MOVIE4x);
myYArray = new Array(_root.MOVIE1y, _root.MOVIE2y, _root.MOVIE3y, _root.MOVIE4y);
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;
}
MOVIE1x = _root.MOVIE1._x;
MOVIE1y = _root.MOVIE1._y;
MOVIE2x = _root.MOVIE2._x;
MOVIE2y = _root.MOVIE2._y;
MOVIE3x = _root.MOVIE3._x;
MOVIE3y = _root.MOVIE3._y;
MOVIE4x = _root.MOVIE4._x;
MOVIE4y = _root.MOVIE4._y;
}
function char_release(char){
if (!char.found){}
else{
char._x = origX;
char._y = origY;
}}
kCount = 46;
init();
init();
stop ();
RESET_btn.onRelease = function() {
_root.init();
}
-----------------------------------------------------------------------------------------------------------------
MOVIE SYMBOL SHUFFLE AS1
--------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN AS1
REPLACE BLUE LINE WITH RED LINE FOR AS2 CODE
myItemArray[x] = parseInt(Math.random() * 9) + myItemArray[x];
myItemArray[x] = Math.floor(Math.random() * 9) + myItemArray[x];
---------------------------------------------------------------------------------------------------------------------
// MAKE FOUR MOVIE SYMBOLS WITH INSTANCE NAMES MOVIE1,MOVIE2,MOVIE3,MOVIE4
function init(){
myItemArray = new Array("MOVIE1", "MOVIE2", "MOVIE3", "MOVIE4");
var x = 0;
while (x < kCount){
myItemArray[x] = parseInt(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.MOVIE1x, _root.MOVIE2x, _root.MOVIE3x, _root.MOVIE4x);
myYArray = new Array(_root.MOVIE1y, _root.MOVIE2y, _root.MOVIE3y, _root.MOVIE4y);
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;
}
MOVIE1x = _root.MOVIE1._x;
MOVIE1y = _root.MOVIE1._y;
MOVIE2x = _root.MOVIE2._x;
MOVIE2y = _root.MOVIE2._y;
MOVIE3x = _root.MOVIE3._x;
MOVIE3y = _root.MOVIE3._y;
MOVIE4x = _root.MOVIE4._x;
MOVIE4y = _root.MOVIE4._y;
}
function char_release(char){
if (!char.found){}
else{
char._x = origX;
char._y = origY;
}}
kCount = 46;
init();
init();
stop ();
RESET_btn.onRelease = function() {
_root.init();
}
OR USE SHUFFLE 3 MOVIE CLIPS CODE IN AS2
READ MORE:
Creating a Concentration game in Flash
http://img2.timg.co.il/forums/58067874.pdf----------------------------------------------------------------------------------------------------------------
// MAKE FOUR MOVIE SYMBOLS WITH INSTANCE NAMES MOVIE1,MOVIE2,MOVIE3,MOVIE4
kCount = 46;
init();
init();
function init(){
myItemArray = new Array("MOVIE1", "MOVIE2", "MOVIE3");
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.MOVIE1x, _root.MOVIE2x, _root.MOVIE3x);
myYArray = new Array(_root.MOVIE1y, _root.MOVIE2y, _root.MOVIE3y);
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;
}
MOVIE1x = _root.MOVIE1._x;
MOVIE1y = _root.MOVIE1._y;
MOVIE2x = _root.MOVIE2._x;
MOVIE2y = _root.MOVIE2._y;
MOVIE3x = _root.MOVIE3._x;
MOVIE3y = _root.MOVIE3._y;
}
----------------------------------------------------------------------------------------------------------------
SIMPLE MC ARRAY IN AS2
https://www.kirupa.com/forum/showthread.php?312905-AS2-Help-with-functions-applied-to-button-array
MAKE 4 MOVIE CLIPS AND GIVE INSTANCE NAME
mc1, mc2, mc3, mc4
---------------------------------------------------------------------------------------------------------------
import mx.transitions.Tween;
import mx.transitions.easing.*;
var btnArray:Array = new Array(mc1, mc2, mc3, mc4);
for (i=0; i<btnArray.length; i++) {
///initail state///
btnArray[i]._alpha = 10;
btnArray[i].enabled = true;
btnArray[i].id = i;
btnArray[i].onRollOver = function() {
//this._alpha = 100;
new Tween(this, "_alpha", Regular.easeIn, this._alpha, 100, 1, true);
};
btnArray[i].onRollOut = function() {
//this._alpha = 10;
new Tween(this, "_alpha", Regular.easeIn, this._alpha, 10, 1, true);
};
btnArray[i].onRelease = function() {
releaseF(this.id);
};
}
////onRelease function///
releaseF = function (rf) {
for (var i = 0; i<btnArray.length; i++) {
if (i != rf) {
this.btnArray[i].enabled = true;
new Tween(this.btnArray[i], "_alpha", Regular.easeIn, this.btnArray[i]._alpha, 10, 1, true);
//this.btnArray[i]._alpha = 10;
} else {
this.btnArray[i].enabled = false;
new Tween(this.btnArray[i], "_alpha", Regular.easeIn, this.btnArray[i]._alpha, 100, 1, true);
//this.btnArray[i]._alpha = 100;
}
}
};
EmoticonEmoticon