Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > FileReference (flash.net.FileReference) > cancel (FileReference.cancel method) | |||
public cancel() : Void
Cancels any ongoing upload or download operation on this FileReference object.
Availability: ActionScript 1.0; Flash Player 8
The following example downloads approximately half of the requested file and then cancels the download. This is obviously not a typical usage. You might more often use this method to allow users to click Cancel in a download status dialog box.
import flash.net.FileReference;
var listener:Object = new Object();
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
if(bytesLoaded >= (bytesTotal / 2)) {
file.cancel();
}
}
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/00002207.html
Comments
No screen name said on Sep 28, 2006 at 9:50 PM :