onProgress (FileReference.onProgress event listener)

onProgress = function(fileRef:FileReference, bytesLoaded:Number, bytesTotal:Number) {}

Invoked periodically during the file upload or download operation. The onProgress listener is invoked while the Flash Player transmits bytes to a server, and it is periodically invoked during the transmission, even if the transmission is ultimately not successful. To determine if and when the file transmission is successful and complete, use onComplete.

In some cases, onProgress listeners are not invoked; for example, if the file being transmitted is very small, or if the upload or download happens very quickly.

File upload progress cannot be determined on Macintosh platforms earlier than OS X 10.3. The onProgress event is called during the upload operation, but the value of the bytesLoaded parameter is -1, indicating that the progress cannot be determined.

Availability: ActionScript 1.0; Flash Player 8

Parameters

fileRef:FileReference - The FileReference object that initiated the operation.

bytesLoaded:Number - The number of bytes transmitted so far.

bytesTotal:Number - The total size of the file to be transmitted, in bytes. If the size cannot be determined, the value is -1.

Example

The following example traces the progress of a download using the onProgress event listener.

import flash.net.FileReference;

var listener:Object = new Object();

listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
    trace("onProgress: " + file.name + " with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
var url:String = "http://www.adobe.com/platform/whitepapers/platform_overview.pdf";
fileRef.download(url, "FlashPlatform.pdf");

See also

onComplete (FileReference.onComplete event listener)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001671.html