FileReference (flash.net.FileReference)
575
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
: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.
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: " + bytes
" 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");
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...