FileReference (flash.net.FileReference)
567
Returns
Boolean
- A value of
true
if the dialog box in which a user can select a file is displayed. If the
dialog box is not displayed, the method returns
false
. The dialog box could fail to be
displayed for any of the following reasons:
■
You did not pass a value for the
url
parameter.
■
The parameters passed are of the incorrect type or format.
■
The
url
parameter has a length of 0.
■
A security violation occurred; that is, your SWF file attempted to access a file from a server
that is outside your SWF file's security sandbox.
■
Another browse session is already in progress. A browse session can be started by
FileReference.browse()
,
FileReferenceList.browse()
, or
FileReference.download()
.
■
The protocol is not HTTP or HTTPS.
Example
The following example attempts to download a file using the
download
method. Notice that
there are listeners for all of the events.
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
}
listener.onCancel = function(file:FileReference):Void {
trace("onCancel");
}
listener.onOpen = function(file:FileReference):Void {
trace("onOpen: " + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number,
bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytes " bytesTotal: " +
bytesTotal);
}
listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...