You are here: Home > Programming > Flash programming > Preloading

Preloading

Print versionEdit this page
With a preloader you can order one or multiple files (.swf or .jpg) to load (download) into a movieclip, thereby keeping track of the percentage downloaded and possible errors.

Preloading in Flash MX 2004

In Flash 7 a new loader class is included: MovieClipLoader. This class is not backward compatible, it works only in Flash 7 - for Flash 6 see below.

Example usage

MovieClipLoader_implementation.asexternal link

Documentation

From FL_ActionScript_Ref.pdf:

This class lets you implement listener callbacks that provide status information while SWF or JPEG files are being loaded (downloaded) into movie clips. To use MovieClipLoader features, use MovieClipLoader.loadClip() instead of loadMovie() or MovieClip.loadMovie() to load SWF files.

After you issue the MovieClipLoader.loadClip() command, the following events take place in the order listed:

Note: You can call MovieClipLoader.getProgress() at any time during the load process.

After MovieClipLoader.onLoadInit()has been invoked, you can set properties, use methods, and otherwise interact with the loaded movie.

If the file fails to load completely, the MovieClipLoader.onLoadError() listener is invoked.

Preloading in Flash 6

Additional info

Note: for Win/IE, the default limit of concurrent http processes is 2, so you can never load more than 2 objects at the same time. This is a user preference, but most users won't change the default setting. Loading more simultaneous objects won't gain you time.

Links


-- ArthurClemens - 15 Sep 2003

Attachment: sort Action: Size: Date: Who: Comment:
MovieClipLoader_implementation.as action 1309 15 Sep 2003 - 13:02 ArthurClemens Example use of MovieClipLoader