View Full Version : preloaders needed?
Dizzzzy
06-22-2005, 05:03 PM
Is it typical to have the first frame of a swf display "undefined" when drafting from a text file, I have the rest of the frames in a demo i'm launching load from a sourced .txt file fine, however the very first frame is not loading the variable in time I think, because when I go forward a frame then return to frame one ... it then displays the correct string.
Should I need to preload the .txt file??? and or how should I go about solving prob.
oldnewbie
06-22-2005, 09:07 PM
What are you using to load your text file, loadVariables?
You should use the LoadVars() object instead, or use an onEnterFrame function (deleted when done) on the first frame, until the variable is no longer undefined.
Dizzzzy
06-27-2005, 07:46 PM
well heres the situation. I'm running this AS in the 1st frame of the swf loaded from a frame in the Launcher/projector file.
//loadVariables("ea.txt",this);
Text = new LoadVars();
Text.load("ea.txt");
box.text=this.a1;
Text.onLoad = function(success){
if(success){
box.text=this.a1;
}else{
box.text=("LOADING...");
}
}
stop();
the reason I have loadVariables in tehre is because I couldn't get the frames following frame 1 to load. I thought that AS would follow for every frame of the mc?!?.. How would you go about doing this.
the AS for frame 2 is only
box.text=this.a2; ( not working) hence me using loadVariables on frame 1 and frame 2 I used box.text=a2;
This is obviously a crappy way for an uneducated such as myself help a bro out... thanx
oldnewbie
06-28-2005, 05:36 AM
Don't use "Text" alone as the LoadVars() object, it might confuse Flash, since it's revserved...
Try something like this...
myText = new LoadVars();
myText.load("ea.txt");
myText.onLoad = function(success){
if(success){
trace("Loaded!");
_level0.a1 = this.a1;
_level0.a2 = this.a2;
_level0.a3 = this.a3;
// Etc... for all your variables...
// And then set the box text on the first frame...
box.text = _level0.a1;
}else{
trace("Loading failed!");
//box.text=("LOADING...");
}
}
stop();
Then on your second frame...
stop();
box.text = _level0.a2;
Dizzzzy
06-28-2005, 03:13 PM
hey much thanks... again it works great if i'm simply running that swf... but when I launch the .swf with loadMovieNum("clip.swf",1) I'm getting undefined in the textbox?!?
anyideas this is obviously some path related prob... do I reference it with box.text=_root.mc1.mc2.a1
oldnewbie
06-28-2005, 03:42 PM
Didn't check it online, but it works for me my friend, at least locally, when I load that movie in another main movie's level 1...
Dizzzzy
06-29-2005, 09:02 PM
Ok problem resolved... it was the _level0 directing the varibales to the level the menu was on... I just removed any instance of _level0 in the AS and it works... thanx oldnewbie.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.