Preloader and external SWF---not clear on how

Ok… so I’ve spent the day trying to figure out how to get my preloader to work on external SWF’s. I can’t put the preloader on the SWF because I want to make a “generic” preloader that is easy for my co-workers to use. Having read several, several threads, I tried putting the SWF in a level, then refering the preloader to that level. No luck there. The preloader won’t sense it… or maybe the movie won’t go back to the preloader… I don’t know.

Frame 1:
onClipEvent (load){
totalwidth = getProperty(_root.loadbar,_width);
widthfactor=(totalwidth/100);
}
onClipEvent (enterFrame){
var total= level10.getBytesTotal();
var loadedup= level10.getBytesLoaded();
trace (total);
if (loadedup==total){
_root.gotoAndPlay(2);
}else{
gotoAndStop(1);
percent=Math.round ((loadedup/total)100);
_root.loadbar._width=(widthfactor
percent);
output_txt=“loading(” + percent + “%” + “)”;
}
}

Frame 2:

stop();
loadMovieNum (“GenInfoGame2.swf”,10);

The movie loads fine (just no preloader).
The preloader works fine with the appropriate modifications for a normal image on frame 2.

I know the problem is with references… but I don’t know how to fix it. Anyone out there (Lunatic???) :wink:

onClipEvent (load){
totalwidth = getProperty(_root.loadbar,_width);
widthfactor=(totalwidth/100);
}
onClipEvent (enterFrame){
var total= level10.getBytesTotal();
var loadedup= level10.getBytesLoaded();
trace (total);
if (loadedup==total){
_root.gotoAndPlay(2);
}else{
gotoAndStop(1);
percent=Math.round ((loadedup/total)100);
_root.loadbar._width=(widthfactor
percent);
output_txt=“loading(” + percent + “%” + “)”;
}
}

you have this on as frame action?
clip events are specific to movie clips.
What I’d do is have an empty mc sitting on-stage with the above script on it. On the first frame, have your load movie script and a stop.

The way this was set up, you were asking it to get the total amount of bytes from a level that was empty.

here’s the way i’d do it:
on the empty MC:

onClipEvent (load){
  totalwidth = getProperty(_root.loadbar._width);
  widthfactor=(totalwidth/100);
 }
 onClipEvent (enterFrame){
  var total= level10.getBytesTotal();
  var loadedup= level10.getBytesLoaded();
  trace (total);
   percent=Math.round ((loadedup/total)*100);
   _root.loadbar._width=(widthfactor*percent);
   output_txt="loading(" + percent + "%" + ")";
       if (loadedup==total){
        _level10.gotoAndPlay(2);
       }else{
        _level10.Stop();
     }
 }

frame 1 action:

 stop();
 loadMovieNum ("GenInfoGame2.swf",10);
  

Thanks for the advice. I’m not sure I understand, though. If I put the code on an empty movie clip, how will I work the graphic part of my preloader? (If all the graphics are on a seperate mc, why bother using an empty movie clip?) Also, why _level10.gotoAndPlay(2) when you are loading into frame 1?

Sorry… I guess I’m just a bit dense…

Yeah… I tried it (as I think I understand what you are saying), and it doesn’t work.

:frowning:

Any ideas?