Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : How do I figure out when data has loaded?


duuman
4/7/2004 11:56:57 PM
Well, my goal is to load variables from a text file, and when they have loaded,
move to a frame that will display them. I have done this before, in mx, but now
I am using 2004. In MX I didn't need to check whether it loaded, it always
seemed to work. Now when I try it, it works locally, but not all the time, and
on the web it doesnt work at all. The actual code I am using to load the stuff
is:

randvar = random(10000000000000000);
loadVariablesNum("Text file" + "rand=" + randvar, 0);
ShadowKnyte
4/8/2004 12:12:38 AM
duuman
4/8/2004 12:16:23 AM
Laiverd.COM
4/8/2004 2:13:23 AM
You always had to check for variables to load, ever since the beginning of
loadvariables times. Anyway: since MX the most convenient way is to use the
LoadVars object, which gives you complete control over where vars are
loaded, which vars are loaded/sent and gives you the onLoad event which is
triggered when the datastream has completed. This way is really much more
compact and convenient than having to create a time or framebased loop.
Examples in the as-dictionary.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

Laiverd.COM
4/8/2004 2:21:53 AM
The XML object comes in handy if you load XML. The methods and data are more
elaborate thatn those for the LoadVars object. For a simple textfile;
loadVars should be enough. It goes without saying however that XML is a
pretty nice way of getting external data into Flash. Multiple tutorials out
there on the subject:
pretty old but nevertheless:
http://actionscript-toolbox.com/xmlobject.php
http://www.ultrashock.com/ff.htm?http://www.ultrashock.com/tutorials/flash5/xml_pitfall.html

And of course the manual as always.

John

--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------

duuman
4/9/2004 6:37:12 AM
Bah, can't figure out how to use loadvars. I'm trying something like the below
code to load a txt file, and move the movie on when its loaded, but it isnt
working.

stop();
randvar = random(10000000000000000);
loadVariablesNum("textfile.txt?" + "rand=" + randvar, 0);
onData = function() {
nextFrame();
}
AddThis Social Bookmark Button