FileUpload

Kind of class:public class
Package:com.example.programmingas3.fileio
Inherits from:UIComponent
Classpath:com.example.programmingas3.fileio.FileUpload
File last modified:Thursday, 01 June 2006, 10:58:24

Summary


Constructor
Constants
Instance properties
  • fr : FileReference
  • pb : ProgressBar
  • btn : Button
Instance methods
  • init (pb:ProgressBar, btn:Button) : void
    • Set references to the components, and add listeners for the SELECT, OPEN, PROGRESS, and COMPLETE events.
  • cancelUpload : void
    • Immediately cancel the upload in progress and disable the cancel button.
  • startUpload : void
    • Launch the browse dialog box which allows the user to select a file to upload to the server.
  • selectHandler (event:Event) : void
    • Begin uploading the file specified in the UPLOAD_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 upload operation.
  • progressHandler (event:ProgressEvent) : void
    • While the file is uploading, update the progress bar's status and label.
  • completeHandler (event:Event) : void
    • Once the upload has completed, change the progress bar's label and disable the "Cancel" button since the upload is already completed.

Constructor

FileUpload

public function FileUpload (
)

Constants

UPLOAD_URL

private const UPLOAD_URL:String = "http://www.yourdomain.com/upload_script.cfm"
(read)

Instance properties

btn

private btn:Button
(read)

fr

private fr:FileReference
(read)

pb

private pb:ProgressBar
(read)

Instance methods

cancelUpload

public function cancelUpload (
) : void

Immediately cancel the upload in progress and disable the cancel button.

completeHandler

private function completeHandler (
event:Event) : void

Once the upload has completed, change the progress bar's label and
disable the "Cancel" button since the upload is already completed.

init

public function init (
pb:ProgressBar, btn:Button) : void

Set references to the components, and add listeners for the SELECT,
OPEN, 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
upload operation.

progressHandler

private function progressHandler (
event:ProgressEvent) : void

While the file is uploading, update the progress bar's status and label.

selectHandler

private function selectHandler (
event:Event) : void

Begin uploading the file specified in the UPLOAD_URL constant.

startUpload

public function startUpload (
) : void

Launch the browse dialog box which allows the user to select a file to upload to the server.