FileDownload
| Kind of class: | public class |
|---|---|
| Package: | com.example.programmingas3.fileio |
| Inherits from: | UIComponent |
| Classpath: | com.example.programmingas3.fileio.FileDownload |
| File last modified: | Thursday, 01 June 2006, 10:58:24 |
Summary
Constructor
Constants
- DOWNLOAD_URL : String
Instance methods
- init (pb:ProgressBar, btn:Button) : void
- Set references to the components, and add listeners for the OPEN, PROGRESS, and COMPLETE events.
- cancelDownload : void
- Immediately cancel the download in progress and disable the cancel button.
- startDownload : void
- Begin downloading the file specified in the DOWNLOAD_URL constant.
- openHandler (event:Event) : void
- When the OPEN event has dispatched, change the progress bar's label and enable the "Cancel" button, which allows the user to abort the download operation.
- progressHandler (event:ProgressEvent) : void
- While the file is downloading, update the progress bar's status and label.
- completeHandler (event:Event) : void
- Once the download has completed, change the progress bar's label and disable the "Cancel" button since the download is already completed.
Constructor
FileDownload
public function FileDownload (
)
Constants
DOWNLOAD_URL
private const DOWNLOAD_URL:String = "http://www.yourdomain.com/file_to_download.zip"
(read)
Instance properties
btn
private btn:Button
(read)
fr
private fr:FileReference
(read)
pb
private pb:ProgressBar
(read)
Instance methods
cancelDownload
public function cancelDownload (
) : void
Immediately cancel the download in progress and disable the cancel button.
completeHandler
private function completeHandler (
event:Event) : void
Once the download has completed, change the progress bar's label and
disable the "Cancel" button since the download is already completed.
disable the "Cancel" button since the download is already completed.
init
public function init (
pb:ProgressBar,
btn:Button) : void
Set references to the components, and add listeners for the OPEN,
PROGRESS, and COMPLETE events.
PROGRESS, and COMPLETE events.
openHandler
private function openHandler (
event:Event) : void
When the OPEN event has dispatched, change the progress bar's label
and enable the "Cancel" button, which allows the user to abort the
download operation.
and enable the "Cancel" button, which allows the user to abort the
download operation.
progressHandler
private function progressHandler (
event:ProgressEvent) : void
While the file is downloading, update the progress bar's status and label.
startDownload
public function startDownload (
) : void
Begin downloading the file specified in the DOWNLOAD_URL constant.