How can I use "setChildIndex" with animate 2015 for chose the index of movieclip
Hello,
I'm French an I try to convert my old AS3 sciences App to HTML5 canvas with animate 2015.
I made an exemple for explain my probreme. I m trying to use "randel" for chose the z-index of movieclip
I cant't attach the .fla
You can download here : http://svt.riffiod.fr/Z_index.fla
I past the code here
"
this.stop();
let root = this;
function randel (tab){
var r = Math.round (Math.random() * (tab.length - 1));
var rec = tab[r];
tab.splice (r, 1);
return rec;
}
//make array with number 1 to 4
var MyArray = new Array();
for (var i=0; i<5; i++){
MyArray[i] = (i+1);
}
//
while (MyArray.length){
var MyIndex = new Array();
for (var j=0; j<5; j++){
MyIndex[j] = 2 + randel(MyArray);
}
}
root.setChildIndex(root.MovieClip01, MyIndex[0]);
root.setChildIndex(root.MovieClip02, MyIndex[1]);
root.setChildIndex(root.MovieClip03, MyIndex[2]);
root.setChildIndex(root.MovieClip04, MyIndex[3]);
"
but the movieClip stay at the same index that I put on the root (stage).
How I can do for have a randel z-index postition for different movieclip?
Thanks
Romain RIFFIOD
