Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 411

Programming actionscript 3.0
Table of Contents

Advertisement

/**
* Define reference to the download ProgressBar component.
*/
private var pb:ProgressBar;
/**
* Define reference to the "Cancel" button which will immediately stop
* the current download in progress.
*/
private var btn:Button;
The first variable,
DOWNLOAD_URL
the user's computer when the user clicks the Download button in the main application file.
The second variable,
FileDownload.init()
user's computer.
The last two variables,
instances on the Stage, which get initialized by the
Initializing the FileDownload component
The FileDownload component is initialized by calling the
FileDownload class. This method takes two parameters,
and Button component instances, respectively.
The code for the
init()
/**
* Set references to the components, and add listeners for the OPEN,
* PROGRESS, and COMPLETE events.
*/
public function init(pb:ProgressBar, btn:Button):void
{
// Set up the references to the progress bar and cancel button,
// which are passed from the calling script.
this.pb = pb;
this.btn = btn;
fr = new FileReference();
fr.addEventListener(Event.OPEN, openHandler);
fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
fr.addEventListener(Event.COMPLETE, completeHandler);
}
, contains the path to the file, which gets downloaded onto
, is a FileReference object that gets initialized within the
fr
method and will handle the downloading of the remote file to the
and
, contain references to ProgressBar and Button component
pb
btn
method is as follows:
FileDownload.init()
method in the
init()
and
, which are ProgressBar
pb
btn
Example: Uploading and downloading files
method.
411

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents