16.4. Determining Load Progress

Problem

You want to monitor the load progress for content you are loading with MovieClipLoader, Loader, Window, or ScrollPane.

Solution

Use the Macromedia v2 ProgressBar component.

Alternatively, for a smaller file size, use the Flash 8 Cookbook ProgressBar component.

If you want a completely programmatic solution, and you have used MovieClipLoader to load the content in the first place, you can use a listener object with MovieClipLoader to monitor the load progress.

Discussion

When you are loading SWF and/or JPEG content into your Flash application, one important consideration is the time it will take to load the content. Most often, you want to make sure the user is notified as to what is going on as content loads. For example, if you are loading a 50KB .swf file and the user is connecting to your application over a dial-up connection, the content will not appear right away. In the interim, you want to make sure that the user at least knows that the content is loading. Otherwise he or she may be led to think that an error has occurred.

Macromedia provides a ProgressBar component that you can use to monitor the load progress and display that progress to the user. To use the Macromedia ProgressBar with a Loader, ScrollPane, or Window component instance, complete the following steps:

  1. Add a ProgressBar instance to the stage by dragging it from the Components panel (you’ll find it in the UI Components folder) to the stage at the point where you want it to appear. ...

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.