[FMX] Array scope problem

Greeting to all of you guys!
I’ve been working with fmx for almost 4 months now and i really love it. I’ve recently started working with PHP and mySQL, and this is where it got even better!!! =)
Unfortunately, i’ve stepped into a problem, and i can’t solve it, so i’d like to hear any ideas…
The story is:
I’ve created a new loadVars() object named eg. “getThem” in the root timeline, which receives the variables from a php script, and puts them in an array. This array is named eg. “varsArray” and is created inside the “getThem.onLoad” function.
The problem is that i need to use this array inside another movieclip, but no matter what, as soon as the “getThem.onLoad” function ends, the array is destroyed…
Is there any way to keep this array out of the function???
I’ve tried “_global.varsArray” or “_root.varsArray” but it wouldn’t work…
Has anyone got any ideas???

Thanx in advance.
Or1onas.

Did you try setInterval…?

Just a quick test, tell me how it goes.

myLoadVars = myLoadVars2 = new LoadVars();
myLoadVars.randomVariable = new Date().getTime();
myLoadVars.sendAndLoad(“phpfile.php”, myLoadVars2, “GET”);//Please keep it as GET
init = function{
//Remove the for…in loop if you have another idea for an array creation process, don’t forget to target myLoadVars2!
for(vars in myLoadVars2){
myArrayTest = myLoadVars[vars].split(",");
trace(myArrayTest)
}
}
setInterval(init, 1000);

Sorry, Untested, I don’t have flash installed on this pc…

Can you post the code you’re using?

theTracks.load(“http://localhost/tracks.php?trackID=”+rand);
theTracks.onLoad = function() {
tracksArray = new Array();
for (var b in this) {
if (b != “onLoad”) {
tracksArray.push(this**);
}
}
_global.playlist = tracksArray; //tried that, but it won’t work
};

Hmm, try:

theTracks = new LoadVars();
theTracks.load(“http://localhost/tracks.php?trackID=”+rand);
tracksArray = new Array();
this.onEnterFrame = function(){
for (b in theTracks) {
tracksArray.push(this**);
}
}

Also, did you try the attempt posted above…?