Got a request?
Email us...

ActionScript Reference crumb.gif Movie Clip Control crumb.gif MovieClipLoader.getProgress()

MovieClipLoader.getProgress()

Availability:
Flash Player 7

Usage:
MovieClipLoader.getProgress( target_mc );

Description:
Returns an object with two items in it; bytesTotal and bytesLoaded. The bytesTotal represents the total number of bytes of the target_mc movie clip (or JPEG) being loaded in using the MovieClipLoader's loadClip method. The other item, bytesLoaded, contains the number of bytes currently loaded by Flash. This method is useful for building your own preloader for content being loaded in using the MovieClipLoader class, or to integrate your MovieClipLoader with a premade ProgressBar component.

Example:
The code below uses the onLoadProgress listener to call the getProgress method. The onLoadProgress listener is called repeatedly until the content has completed loading.

this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
var myImage:MovieClipLoader = new MovieClipLoader();
var listenerObject:Object = new Object();
listenerObject.onLoadComplete = function() {
trace(" -- onLoadComplete");
};
listenerObject.onLoadProgress = function() {
trace(" -- onLoadProgress");
var stats:Object = myImage.getProgress(logo_mc);
trace("bytesLoaded: "+stats.bytesLoaded+" of "+stats.bytesTotal);
};
myImage.addListener(listenerObject);
myImage.loadClip("images/image1.jpg", logo_mc);

The above code produces the following result (or something similar) in the Output panel in Flash when you test the movie.

-- onLoadProgress
bytesLoaded: 65536 of 116318
-- onLoadProgress
bytesLoaded: 116318 of 116318
-- onLoadComplete

REFERENCE SEARCH


RELATED ENTRIES

...r.onLoadComplete()
...ader.addListener()
...oader.unloadClip()
...pLoader.loadClip()
...ieClipLoader class

LINK TO US