MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 557

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example creates a FileReference object that prompts the user to select an image
or text file to be uploaded. It also listens for any possible event.
import flash.net.FileReference;
var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
allTypes.push(imageTypes);
var textTypes:Object = new Object();
textTypes.description = "Text Files (*.txt, *.rtf)";
textTypes.extension = "*.txt;*.rtf";
allTypes.push(textTypes);
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
if(!file.upload("http://www.yourdomain.com/
yourUploadHandlerScript.cfm")) {
trace("Upload dialog failed to open.");
}
}
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: " + bytesLoaded + " bytesTotal: " +
bytesTotal);
}
listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}
listener.onHTTPError = function(file:FileReference):Void {
trace("onHTTPError: " + file.name);
}
listener.onIOError = function(file:FileReference):Void {
FileReference (flash.net.FileReference)
557

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF