Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > FileReferenceList (flash.net.FileReferenceList) | |||
Object
|
+-flash.net.FileReferenceList
public class FileReferenceList
extends Object
The FileReferenceList class provides a means to let users select one or more files for uploading. A FileReferenceList object represents a group of one or more local files on the user's disk as an array of FileReference objects. For detailed information and important considerations about FileReference objects and the FileReference class, which you use with FileReferenceList, see the FileReference class.
To work with the FileReferenceList class:
var myFileRef = new FileReferenceList();FileReferenceList.browse(), to display a dialog box in which the user can select one or more files to upload: myFileRef.browse();browse() is successfully called, the fileList property of the FileReferenceList object is populated with an array of FileReference objects.FileReference.upload() on each element in the fileList array.The FileReferenceList class includes a browse() method and a fileList property for working with multiple files.
Availability: ActionScript 1.0; Flash Player 8
The following example allows a user to select multiple files and then uploads each of them to a server.
import flash.net.FileReferenceList;
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(fileRefList:FileReferenceList) {
trace("onSelect");
var list:Array = fileRefList.fileList;
var item:FileReference;
for(var i:Number = 0; i < list.length; i++) {
item = list[i];
trace("name: " + item.name);
trace(item.addListener(this));
item.upload("http://www.yourdomain.com/");
}
}
listener.onCancel = function():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: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}
listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}
listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
trace("onHTTPError: " + file.name + " httpError: " + httpError);
}
listener.onIOError = function(file:FileReference):Void {
trace("onIOError: " + file.name);
}
listener.onSecurityError = function(file:FileReference, errorString:String):Void {
trace("onSecurityError: " + file.name + " errorString: " + errorString);
}
var fileRef:FileReferenceList = new FileReferenceList();
fileRef.addListener(listener);
fileRef.browse();
FileReference (flash.net.FileReference)
|
Modifiers |
Property |
Description |
|---|---|---|
|
|
fileList |
An array of FileReference objects. |
Properties inherited from class Object
|
Event |
Description |
|---|---|
|
onCancel |
Invoked when the user dismisses the file-browsing dialog box. |
|
onSelect |
Invoked when the user selects one or more files to upload from the file-browsing dialog box. |
|
Signature |
Description |
|---|---|
|
Creates a new FileReferenceList object. |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
|
addListener |
Registers an object to receive notification when a FileReferenceList event listener is invoked. |
|
|
browse |
Displays a file-browsing dialog box in which the user can select one or more local files to upload. |
|
|
removeListener |
Removes an object from the list of objects that receive event notification messages. |
Methods inherited from class Object addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch
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/00002226.html
Comments
No screen name said on Nov 10, 2005 at 1:40 AM : spor1 said on Nov 10, 2006 at 3:58 PM :