Load variables to level with timeout

If you make a waiting loop after loading variables and your server doesn't respond at all, you wait until the end of time. Here is a script to avoid this: Append the string "&loaded=1" to your textfile. (without the hyphens) Then write the following script: frame 1: //init variable loaded loaded="" //init time seconds = 60; endtime = getTimer() + seconds * 1000; // load variables to level 0 _level0.loadVariables("myVar.txt",""); frame 2: // nothing frame 3: //loop while loaded is not set and we are in time if(loaded eq "" and getTimer() < endtime) gotoAndPlay(2) frame 4: // check if loaded is set if(loaded ne ""){//ok loaded is set gotoAndPlay(6); } else {//timeouterror gotoAndStop(5); } frame 5: // show timeouterror frame 6: // ok, start the show
Dan McLean Date: 17/04/2002
Any reason why you need to include the: "&loaded=1" into the variable file? Couldn't you have a onClipEvent(data) { loaded = 1; } on the movie clip instead? this means that people using this method do not have to change variable files or server-side code. Just a thought! Hope it helps!
Add comment