Flash CS4 Professional ActionScript 2.0

MovieClipLoader

 Object
    |
    +-MovieClipLoader

public class MovieClipLoader
extends  Object

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

NOTE MovieClipLoader support for GIF and PNG file formats was new to Flash 8. If you import a project from an earlier version of the tool, you need to update the Publish settings to target Flash 8, or later, otherwise only SWF and JPEG file formats will work.

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

  • When the first bytes of the downloaded file have been written to the hard disk, the MovieClipLoader.onLoadStart listener is invoked.
  • If you have implemented the MovieClipLoader.onLoadProgress listener, it is invoked during the loading process. Note: You can call MovieClipLoader.getProgress() at any time during the load process.
  • When the entire downloaded file has been written to the hard disk, the MovieClipLoader.onLoadComplete listener is invoked.
  • When the downloaded file's first frame actions have been executed, the MovieClipLoader.onLoadInit listener is invoked.

When 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.

NOTE Some browsers' caching of files locally may interfere with MovieClipLoader events. While developing SWF files, clear your browser's cache before testing MovieClipLoader events.

Availability: ActionScript 1.0; Flash Player 7

Property summary

Modifiers

Property

Description

 

checkPolicyFile: Boolean

Specifies whether Flash Player should attempt to download a cross-domain policy file from the loaded object's server before beginning to load the object itself.

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)

Event summary

Event

Description

onLoadComplete = function([target_mc: MovieClip], [httpStatus: Number]) {}

Invoked when a file that was loaded with MovieClipLoader.loadClip() is completely downloaded.

onLoadError = function(target_mc: MovieClip, errorCode: String, [httpStatus: Number]) {}

Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load.

onLoadInit = function([target_mc: MovieClip]) {}

Invoked when the actions on the first frame of the loaded clip have been executed.

onLoadProgress = function([target_mc: MovieClip], loadedBytes: Number, totalBytes: Number) {}

Invoked every time the loading content is written to the hard disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete).

onLoadStart = function([target_mc: MovieClip]) {}

Invoked when a call to MovieClipLoader.loadClip() has begun to download a file.

Constructor summary

Signature

Description

MovieClipLoader()

Creates a MovieClipLoader object that you can use to implement a number of listeners to respond to events while a SWF, JPEG, GIF, or PNG file is downloading.

Method summary

Modifiers

Signature

Description

 

addListener(listener: Object) : Boolean

Registers an object to receive notification when a MovieClipLoader event handler is invoked.

 

getProgress(target: Object) : Object

Returns the number of bytes loaded and the total number of bytes of a file that is being loaded by using MovieClipLoader.loadClip(); for compressed movies, returns the number of compressed bytes.

 

loadClip(url: String, target: Object) : Boolean

Loads a SWF, JPEG, progressive JPEG, unanimated GIF, or PNG file into a movie clip in Flash Player while the original movie is playing.

 

removeListener(listener: Object) : Boolean

Removes the listener that was used to receive notification when a MovieClipLoader event handler was invoked.

 

unloadClip(target: Object) : Boolean

Removes a movie clip that was loaded by using MovieClipLoader.loadClip().

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)