Skip navigation
Currently Being Moderated

A good simple preloader.

Jul 31, 2012 5:48 PM

Tags: #preloader #actionscript_3 #status_bar #graphic_preloader

I've asked some questions regarding this before on a project I had to put on the backburner.  But I'm back to that project now and am looking at it with new fresh eyes so I thought I'd bring it up again in a new discussion.  I'm working on a Flash website, using Actionscript 3 in Flash cs5.5.  I need a preloader...one that loads and opens a seperate swf.  I got some help putting some code together to make a preloader like this and it works but I'd like to make one more visually pleasing. 

Can anybody either give me advice or possibly point me towards a tutorial that will teach me to make a preloader with a some sort of loading graphic, like a status bar or something(doesn't have to be anything too crazy) that will load and open another swf?  I've found tutorials in the passed that show how to make status bars and stuff but they're all coded to load another frame within the same swf, which isn't what I want and I don't know my way around as3 well enough to modify it for what I need.

The key here really is I want it to be simple.  I'm not an actionscript whiz by any stretch. 

thanks guys!

 
Replies
  • Currently Being Moderated
    Jul 31, 2012 5:56 PM   in reply to mentalcase129

    I believe this meets your requirements, and is a preferred approach...

     

    AS3 Preloader
    -------------

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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 2, 2012 4:58 AM   in reply to mentalcase129

    If you look at the loop function in the code he provides, that is what you will use to control things like a loading bar... the key being to understand and make use of the perc value that is being calculated. 

     

    You can use the perc value to control the scaleX of something, such as a status bar...

     

     

    yourStatusBar.scaleX = 0;  // a starting value for your status bar

     

    function loop(e:ProgressEvent):void

    {

        var perc:Number = e.bytesLoaded / e.bytesTotal;

        percent.text = Math.ceil(perc*100).toString();

     

        yourstatusBar.scaleX = perc;

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points