Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > FileReference (flash.net.FileReference) > 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
fileRef:flash.net.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.
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.macromedia.com/platform/whitepapers/platform_overview.pdf";
fileRef.download(url, "FlashPlatform.pdf");
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00002219.html
Comments
snah said on Oct 1, 2005 at 1:12 PM : No screen name said on Jul 12, 2006 at 7:51 PM :