Skip to main content
NancyParker
Participating Frequently
June 25, 2010
Question

Preloader causes my SWF to run dog slow

  • June 25, 2010
  • 1 reply
  • 1790 views

Ok, I am obviously doing something seriously wrong, and admittedly I am very new to AS3 and the way CS5 has the default preloader is a bit confusing to me as well.


I have two files -- one with the preloader AS3:

var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("part2.swf"));

function loop(e:ProgressEvent):void
{
  var perc:Number = e.bytesLoaded / e.bytesTotal;
  percent.text = Math.ceil(perc*100).toString()+"%";
}

function done(e:Event):void
{
  removeChild(percent); // was removeChildAt(0) but it make more sense this way
  percent = null;
  addChild(l);
}

Then I have another SWF with my main content called "part2.swf".

When I "publish" part2.fla, I go to ActionScript settings and select Preloader method as Preloader SWF and then on the line below I select the name of the file that points to the one above that contains the script.

Even when I do a simulate download test on the movie it compiles like a dog.  I don't understand.  If I use the "default preloader" in CS5 ... those annoying little dots with no progress bar or display text (who designed that?) ... it seems to run just fine.

I've tried putting a frame preloader in frame as I understand the "preferred" method is to call an external loader file.  So I'd really like to get an external preloader to work.

Any tips on what I'm doing wrong?  Or anyone have a simple preloader I can use in its place?

Deep bow of thanks for thinking about this with me.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 25, 2010

that preloader method is for runtime shared libraries and doesn't apply to your situation.

NancyParker
Participating Frequently
June 25, 2010

Can you point me to a good simple preloader?

kglad
Community Expert
Community Expert
June 25, 2010

do you want a stand-alone preloader that will load your main swf or do you want to add code to your current main swf?