564
ActionScript classes
Example
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: " + bytes " 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");
creationDate (FileReference.creationDate property)
public creationDate : Date [read-only]
The creation date of the file on the local disk. If the FileReference object has not been
populated, a call to get the value of this property returns
null
.
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example retrieves the creation date of a file selected by the user.
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("creationDate: " + file.creationDate);
}
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse();
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...