jeudi 24 novembre 2016

Replace an item in an array?

Trying to figure some logic and wondering if the following code will work, or if there's another way of doing this. (Just trying to find out if my logic works, might missform a bit of the code)

Thanks in advance!

Var some1:MovieClip = mc_1;
" "
" "
Var other1:MovieClip = mc_a;
" "
" "

Var myArray = [some1, some2, some3];

Var i:uint;
Var iLength:uint = myArray.length;

For(i=0;i<iLength;i++){
If(myArray[i] == some2){
myArray[i] = other1;
}
}

Question: will this replace 'some2' with 'other1'?

Aucun commentaire:

Enregistrer un commentaire