Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loaded txt data not yet loaded?

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
I have a txt file which my flash movie loads two rather long variables from. I give the movie 1 frame to load and on the next frame, start displaing some of the loaded variable. When I run the .swf none of the data shows, however when I right click -> Rewind -> Play, it runs perfectly.

Could this be because the data loaded from the text file is not complete in the time of 1 frame. I've also tried giving it up to 30 frames to load but still the same result.

I've tried 2 methods of loading the txt file:

loadVariablesNum("textfile.txt", 0);
and
_root.loadVariables("textfile.txt");

Both give the same result.
 
The usual way to do this (in case of a long file), is to add a last variable in your file, such as &EOF = true;, and put your loadVariables action in a loop on 2 frames:

Frame 1:

if (EOF == true){
gotoAndPlay(3);
} else {
loadVariables("textfile.txt", "");
}

Frame 2:

gotoAndPlay(1);

Frame 3:

The text file was loaded... Regards,

oldman3.gif
 
Or load them into a movieClip using the onClipEvent(data) event handler ... I find it a much neater solution.

onClipEvent(load) {
loadVariables("textfile.txt", this);
stop();
}
onClipEvent(data) {
gotoAndPlay(2);
}
_____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Or use the new LoadVars() function in MX, it's even neeter than that! Regards,

oldman3.gif
 
Haven't got that far yet ... it's good stuff then? _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Yeah! Maybe you can read about it in Colin Moock's next book! Regards,

oldman3.gif
 
What should the "else" be on that signature? [pipe] Regards,

oldman3.gif
 
You forgot RG! He deserves the "second choice"! Regards,

oldman3.gif
 
*sigh* ... try to help out and what do you get ... _____________________________________________________
Knowledge is attained only by seeking out that which is unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top