Skip to main content
Known Participant
January 29, 2010
Question

preloader code

  • January 29, 2010
  • 1 reply
  • 527 views

I'm using the code from this tutorial for a preloader.  Though I am not using a dynamic text field like the tutorial says.

I took the line referring to the dynamic text field out of the code, but it's still not working?

The animation has 2 frames with movie clips in each. One for the preloader and one for the main content.

Do I need to put somekind of stop or non-looping code in here so it doesn't go back to frame 1(preloader)??

http://schoolofflash.com/blog/2008/04/flash-cs3-tutorial-actionscript-3-preloader/

--------------------------------------------------------------------------------------------------------

this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);

function onProgress(e:ProgressEvent):void
{
    var loaded:Number = e.target.bytesLoaded;
    var total:Number = e.target.bytesTotal;
    var pct:Number = loaded/total;
    loader_mc.scaleX = pct;
}

function onComplete(e:Event):void
{
    nextFrame();
}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 29, 2010

You would do well to have stop(); commands in both frames, though I believe nextFrame() includes a stop action in its landing procedure.

You might want to consider an alternative approach for a preloader design.  Here's a link to another tutorial...

http://www.gotoandlearn.com/play?id=85

k_loyAuthor
Known Participant
January 29, 2010

This worked beautifully!!!!!. Thanks so much. If you were here I'd kiss you.

k_loyAuthor
Known Participant
January 29, 2010

Actually, One more question. I;ve used  lots of transparent PNG files on this site, and this little gallery is the only Flash on the site.

Is there any way to get the get the flash preloader to load first in the HTML and then fake a little longer time just to give the PNGs time to load before the main SWF plays?  I don't want  to mess too much more witht this, but it would be nice I could get it to kind of work in sync with the HTML

Thanks

http://www.michaelmcdonalddesigns.com/