Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > Media components > Media.progress | |||
MediaDisplay, MediaPlayback.
Flash Player 7.
Flash MX Professional 2004.
var listenerObject:Object= new Object();listenerObject.progress = function(eventObj:Object) {// ...};myMedia.addEventListener("progress",listenerObject);
Event; is generated continuously until media has completely downloaded. The Media.progress event object has the following properties:
target A reference to the MediaDisplay or MediaPlayback instance.
type The string "progress".
The following example listens for progress:
var myProgressListener:Object = new Object();
myProgressListener.progress = function(eventObj:Object) {
// Make lightMovieClip blink while progress is occurring.
var lightVisible:Boolean = lightMovieClip.visible;
lightMovieClip.visible = !lightVisible;
};
The following example listens for progress and calls another function if the progress event continues for more than 3000 milliseconds (3 seconds):
// Duration of delay before calling timeOut.
var timeOut:Number = 3000;
// If timeOut has been reached, do this:
function callback(arg) {
trace(arg);
}
// Listen for progress.
var myListener:Object = new Object();
myListener.progress = function(eventObj:Object) {
setInterval(callback, timeOut, "Experiencing Network Delay");
};
md.addEventListener("progress", myListener);
Flash CS3