Forum Moderators: open

Message Too Old, No Replies

loading var from text file into flash

should be simple. doesnt work though. :(

         

benihana

1:47 pm on May 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Im trying to load a single variable from a text file into flash. basically just want to load a number so flash knows how many images it needs to load.

i know the variable is being loaded because i can display it in a dynamic text box, but when i try to assign it a variable name in flash, and trace that variable, i just get 'undefined'

actionscript:

loadNum = new LoadVars ();
loadNum.onLoad = function (ok)
{
if (ok) {

// tyring to assign a nnew variable, numPics the value ive just taken from the text file.
numPics=_root.loadNum.numb;

// displaying loaded var in a text box
_root.numText.text= _root.loadNum.numb;
}
};
loadNum.load ("numpics.txt");

// the trace just displays undefined
trace (numPics);

benihana

2:13 pm on May 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



o.k. solved my own problem.

the 'undefined' was being caused by a slight delay as flash opened and read the file.