Hello,
Inside of the _root.main scripting section, you can loop through each player to call there internal ready() function:
PHP Code:
onSelfEvent (load) {
var n:Number=0;//Declare n outside of the function. = _root.n
loadV = new LoadVars();
MyArray = new Array();
loadV.load("mytext.txt");
loadV.onData = function(s) {
p = s.split('&');
for(i=1; i < p.length; i++) {
MyArray[i]=p[i].split('|');
}
n = parseFloat(MyArray[1][0]);
_root.main.n =n
for(var i=1;i<3;i++){
_root.main["player"+i].ready();//Call the internal ready function inside of each movieclip.
}
}
}
Inside of _root.main.player1 etc... you can store the internal ready function:
PHP Code:
onSelfEvent(load){
h=[];
function ready(){// << Call ready() from the _root.main text loader, since this movieclip is ready before the loader has any data.
for( i=1;i < _root.main.n;i++){
h.push(i)
}
h = h.sort(function (a:int, b:int):int { return Math.random() > .5 ? -1 : 1; });
_root.data_field.text+=(h) + " "
}
}
download v4 (swish)