Hello,
I’m trying to take variables from an external php file and load them into flash. I got most of it working, however i’v ran into a few issues with passing my variables around.
First I declare my global vars on the first keyframe:
onLoad()
{
_global.thedata = new Array();
_global.anum = 0;
}
Then I run my copy function
onEnterFrame()
{
getdata();
sites_txt.text = _global.thedata[1];
}
function getdata()
{
l = new LoadVars();
l.onLoad = function()
{
for(i=0; i<15; i++)
{
_global.thedata* = this["result"+i];
}
}
I am able to confirm that the output from this[“results”+i] is correct. I’m also able to check its entering the array _global.thedata* correctly (if I run some test after the for loop). However, in its current form setting the text box with the value of thedata[1] (after getdata() function) doesn’t appear to be working. All I get is a clear input or sometimes an undefined. Could it be that _global.thedata* = this[“result”+i]; is passing by reference, thus when the function scope deallocates, the original variables are deallocated with it. Is there a way to pass-by-value? or is there something else i’m missing.
Please come be my Link!
Thanks!