MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 493

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Example
The following code creates a Loader instance and sets the
loader must wait for a call to
is set, which indicates where to load content from. Then other tasks can be performed before the
content is loaded with
createClassObject(mx.controls.Loader, "loader", 0);
loader.autoLoad = false;
loader.contentPath = "logo.swf";
// Perform other tasks here and *then* start loading the file.
loader.load();
Loader.percentLoaded
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
loaderInstance.percentLoaded
Description
Property (read-only); a number indicating what percent of the content has loaded. Typically, this
property is used to present the progress to the user in an easily readable form. Use the following
code to round the figure to the nearest integer:
Math.round(bytesLoaded/bytesTotal*100))
Example
The following example creates a Loader instance and then creates a listener object with a
handler that traces the percent loaded and sends it to the Output panel:
progress
createClassObject(Loader, "loader", 0);
loadListener = new Object();
loadListener.progress = function(eventObj){
// eventObj.target is the component that generated the progress event,
// that is, the loader
trace("logo.swf is " + loader.percentLoaded + "% loaded."); // track loading
progress
}
loader.addEventListener("complete", loadListener);
loader.content = "logo.swf";
494
Chapter 6: Components Dictionary
to begin loading content. Next, the
load()
.
loader.load()
property to
autoload
contentPath
so that the
false
property

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents