FileReference (flash.net.FileReference)
579
Example
The following example removes an event listener using the
removeListener
method. If a user
cancels the download, the listener is removed so that it no longer receives events from that
FileReference object.
import flash.net.FileReference;
var listener:Object = new Object();
listener.onCancel = function(file:FileReference):Void {
trace(file.removeListener(this)); // true
}
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");
size (FileReference.size property)
public size : Number [read-only]
The size of the file on the local disk, in bytes. 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 size of a file selected by the user.
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("size: " + file.size + " bytes");
}
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse();
See also
browse (FileReference.browse method)
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...