2 Replies Latest reply on Feb 28, 2008 11:37 AM by Newsgroup_User

    AS3 preloader - code overload

    Level 7
      Is there an easier way to create a custom preloader animation in AS3? The
      only information I can find on the web tends to have about two pages of code
      with stuff like "packages" and "public/private functions" which I've never
      used and unfortunately do not understand. The idea seems simple to me [(var
      ratio = (bytesLoaded/bytesTotal)*100) then have a movie clip (load_mc) one
      hundred frames long displaying 00-99 respectively for each frame. Then find
      some way to call a function that says [load_mc.gotoAndStop(ratio);]. I've
      seen AS2 tutorials on this subject and they all kinda follow this general
      idea. Why then in AS3 do you need two pages of code for an action that
      required 5 or 6 lines of code in a previous version of ActionScript (AS2)?
      No..no...sorry that's not my question. **sighs** I just need to know if
      there is an easier-to-understand method to creating prealoaders in AS3? I'm
      making an intro movie for a new website and the final swiff will probably be
      close to 1 MB so I want to display a simple loading animation instead of a
      blank screen. Any help is greatly appreciated.



        • 1. Re: AS3 preloader - code overload
          robdillon Most Valuable Participant
          Yes, AS3 can look very complex, and many times it is. You don't need to create packages to use AS3. You can, but you don't have to. Writing classes in packages allow you to create libraries of reusable code. You can just write code that will work for you in a frame script space in a layer of your movie. In many cases, and for simple movies, this works just fine.

          To create a preloader animation, you can use the UILoader and ProgressBar classes. You can also use the Loader class. Here's an example that uses the Loader class:
          • 2. Re: AS3 preloader - code overload
            Level 7
            That looks like something I can disect and figure out. WOW...thanks. Not
            sure where you got the number 1024. Are there 1024 bytes in a KB? In any
            case the informations you provided is paramount. Many thanks.