Creating an Activescript Preloader in Adobe Flash CS5

There are many very good tutorials on creating an Actionscript preloader for previous versions of Adobe Flash (see the Avoider Game, or the newer tutorial on Activetuts+).  The principle of a preloader is to allow the Flash program to start displaying something on screen right away, along with some sort of loading screen with time left to finish loading.  This works great especially for large Flash projects.

The problem with these tutorials is that none of them address CS5.  While the Activetuts+ tutorial does describe CS4 well, there is quite a bit of CS3 mention, which makes things a little confusing.  Fortunately, CS5 preloaders are relatively simple.

The below essentially assumes your Flash program is a single frame, utilizing Actionscript to generate your animation/movie.  Following the guidelines given in the above tutorials:

  1. We will use the same “3 frame model”, so create keyframes in frames 2 and 3 as described.
  2. Go to File > Publish Settings and set the Export Frame to 2.
  3. Create the preloader on Frame 1.  This can be Actionscript based as well, not necessarily an instance on the stage as described in the tutorials.
  4. Add the preloader code to the project’s main document class.  We used more of the Avoider model, so we didn’t have to create another preloader class.  Seems simpler this way than the Activetuts+ model.
  5. Add the necessary stop() call in the “Actions” of Frame 1.
  6. Thats it!

Note that we were able to import sound to the library without trouble, exporting it to the new default frame 2.

The big change from the prior tutorials is that the AssetHolder in frame 2 is not needed.

This technique also seems to work fine with Text Layout Framework (TLF) text.  Just make sure the default linkage is set to “Merged into code” under Advanced Actionscript Settings.

On a less positive note, the preloader doesn’t seem to work with Android, as the program seems to skip right over.  We aren’t hopeful for iOS either, but we haven’t tried it yet.

Advertisements

About mahdevteam

Our team develops web, mobile, and other projects on behalf of the Muazzam Ali Hospital project in Jhelum, Pakistan.
This entry was posted in Development and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s