The EAFlashUpload fires a number of events. These events describe user interaction with EAFlashUpload, indicate changes of upload queue, provide information of upload state.
To handle EAFlashUpload events you can use predefined handlers or assign new handler at the initialization stage. The predefined handlers has the following format:

function <EAFlashUpload_ID>_<EventName>() { }


List of events

Event name Description
onMovieLoad Fires after EAFlashUpload have been initialized.
onFilesAdded Fires when files are added to the upload queue.
onFilesRemoved Fires when files are removed from the upload queue.
onFilesSorted Fires when files are sorted in the upload queue.
onQueueChanged Fires when upload queue is changed due to some actions.
onItemSelected Fires when a different files is selected in the upload queue.
onUploadStart Fires when upload begins.
onUploadEnd Fires when upload is completed.
onUploadCancel Fires when upload is canceled by the user or JavaScript method calling.
onFileLoadStart Fires when a file upload operation starts.
onFileLoadEnd Fires when a file upload is successfully completed.
onUploadProgress Dispatched periodically during the file upload.
onUploadError Dispatched if errors occur during upload operation.
onQueueError Fires when files are restricted due to some queue limitations.
onSystemError Fires when various system error occur.
onAsyncRequestStart Fires when asynchronous request starts.
onAsyncRequestEnd Fires when asynchronous request is successfully completed.
onAsyncRequestError Fires when some error occur during asynchronous request.
onImageViewResize Fires when ImageView is loaded on the page and every time when ImageView sizes are changed dynamically.
onImagesAdded Fires when preview images are added to imagesList.
onResizedImagesUploadStart Fires when uploading of resized images is started.
onResizedImagesUploadEnd Fires when uploading of resized images has been finished.
onOriginalImagesUploadStart Fires when uploading of original images begins.
onOriginalImagesUploadEnd Fires when uploading of original images is successfully completed.


onMovieLoad(errors)

Parameters:


Description:

Fires after EAFlashUpload have been initialized. Any interaction with the EAFlashUpload should be archived after this event only. Inside handler of this event you can define custom events handler if you don't want to use predefined.


Examples:

The following example shows how to handle the event on the page:

				
function EAFlashUpload_onMovieLoad(errors) { alert(errors); // define a custom event handler for onUploadStart event EAFlashUpload.onUploadStart = customHandler; } function customHandler() { // appropriate operations }


onFilesAdded(filesIds:Array)

Parameters:


Description:

Fires when the user selects files for upload from the file-browsing dialog box.


Examples:

The following example shows how to handle the event on the page:

				
function EAFlashUpload_onFilesAdded(filesIds) { var addedFiles = EAFlashUpload.getFiles(filesIds); var someDivElement = document.getElementById("DIV_NamesOfFiles"); var filesNames = ""; for(var i = 0; i < addedFiles.length; i++) { filesNames += addedFiles[i].name + "<br />"; } someDivElement.innerHTML = filesNames; }


onFilesRemoved(files:Array)

Parameters:


Description:

Fires when files are deleted from the upload queue. files array contains removed files.


Examples:

The following example shows how to handle the event on the page:

				
function EAFlashUpload_onFilesRemoved(files) { alert(files.length + " files have benn deleted!"); }


onFilesSorted(fieldName:String, isSortDescending:Boolean)

Parameters:


Description:

Fires when files are sorted in the upload queue. This event is used to indicate a change in the order of the data, not a change in the data itself.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onFilesSorted(fieldName, isSortDescending) { alert("The files have benn sorted by " + fieldName + "column in " + (isSortDescending)?"descending ":"ascending" + "order."); }


onQueueChanged(changeType:String)

Parameters:


Description:

Fires when upload queue is changed due to some actions. The event is dispatched after appropriate operation was done.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onQueueChanged(changeType) { alert("The upload queue have been changed!"); }


onItemSelected(selectedIndices:Array)

Parameters:


Description:

Fires when a different files is selected in the upload queue. This event is dispatched when user select rows of fileList element of the TableView or ListView only.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onItemSelected(selectedIndices) { alert(selectedIndieces.length + " files have been selected!"); }


onUploadStart()

Description:

Fires when upload begins. Inside handler of this event you can make some additional validations and if, it is demanded, cancel the upload.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onUploadStart() { alert("The upload have been started!"); }


onUploadEnd()

Description:

Fires when upload is successfully completed and a server response is received. You can get the response data from File.serverResponse property.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onUploadEnd() { alert("The upload have been completed!"); }


onUploadCancel()

Description:

Fires when upload is canceled. The upload can be canceled by pressing a "Cancel" button of the user interface or by calling a cancelUpload method.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onUploadCancel() { alert("The upload have been canceled!"); }


onFileLoadStart(fileObj:File)

Parameters:


Description:

Fires when a file upload operation starts. This event is dispatched for each uploading file in the upload queue.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onFileLoadStart(fileObj) { alert(fileObj.name + " file is being uploaded."); }


onFileLoadEnd(fileObj:File)

Parameters:


Description:

Fires when file is succeessfully uploaded. This event is dispatched for each uploading file in the upload queue.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onFileLoadEnd(fileObj) { alert(fileObj.name + " file has been uploaded."); }


onUploadProgress(progressObj:Progress)

Parameters:


Description:

Dispatched periodically during the file upload. In some cases, onUploadProgress events are not received. For example, when the file being transmitted is very small or the upload happens very quickly a onUploadProgress event might not be dispatched.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onUploadProgress(progress) { var str = ""; for(var prop in progress) { str += prop + ": " + progress[prop] + "<br />"; } document.getElementById("DIV_ProgressSummary").innerHTML = str; document.getElementById("DIV_ProgressBar").style.width = progress.percentsDone + "%"; }


onUploadError(errorObject:Object)

Parameters:


Description:

Dispatched if errors occur during upload operation. There are many reasons of error appearance, they are grouped by type:


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onUploadError(errorObject) { alert("An error occured during upload operation: " + errorObject.message); }


onQueueError(message:String)

Parameters:


Description:

Fires when adding files are restricted due to some queue limitations. The EAFlashUpload has a number of properties allow to define queue restrictions. They are: filesCountLimit, fileSizeLimit, totalSizeLimit.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onQueueError(message) { alert("A queue error have occured: " + message); }


onSystemError(message:String)

Parameters:


Description:

Dispatched when various system error occur. This event may be useful on the development stage.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onSystemError(message) { alert(message); }


onAsyncRequestStart()

Description:

Fires when asynchronous request starts. The request is initiated by sendAsyncRequest.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onAsyncRequestStart() { alert("The asynchronous request has been started!"); }


onAsyncRequestEnd(response:Object)

Parameters:


Description:

Fires when asynchronous request is successfully completed. The response may contain an url variables, so in this case you can convert they to a JavaScript object by using urlVarsToObject method.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onAsyncRequestEnd(response) { alert("The asynchronous request has been completed. the response is: " + response); }


onAsyncRequestError(message:String)

Parameters:


Description:

Fires when some error occur during asynchronous request.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onAsyncRequestError(message) { alert("An error occured during request: " + message); }


onImageViewResize(width:Number, height:Number)

Parameters:


Description:

Fires when ImageView is loaded on the page and every time when ImageView sizes are changed dynamically with changing style properties. The size of imagesList depends on the following properties: imagesList.rowCount, imagesList.columnCount, imagesList.cellStyle.maxImageWidth, imagesList.cellStyle.maxImageHeight and is calculated when ImageView is loaded on the page. Therefore to set up the correct size you need to handle onImageViewResize event.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onImageViewResize(width, height) { EAFlashUpload.style.width = width; EAFlashUpload.style.height = height; }


onImagesAdded(imagesIds:Array)

Parameters:


Description:

Fires when preview images are added to imagesList.


Examples:

The following example shows how to handle the event on the page:

				
function EAFlashUpload_onFilesAdded(imagesIds) { var addedImages = EAFlashUpload.getFiles(imagesIds); var someDivElement = document.getElementById("DIV_NamesOfImages"); var imagesNames = ""; for(var i = 0; i < addedImages.length; i++) { imagesNames += addedImages[i].name + "<br />"; } someDivElement.innerHTML = imagesNames; }


onResizedImagesUploadStart()


Description:

Fires when uploading of resized images is started.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onResizedImagesUploadStart() { alert("Resized images uploading has been started!"); }


onResizedImagesUploadEnd()


Description:

Fires when uploading of resized images has been finished.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onResizedImagesUploadEnd() { alert("Resized images are successfully uploaded!"); }


onOriginalImagesUploadStart()


Description:

Fires when uploading of original images begins.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onOriginalImagesUploadStart() { alert("Original images uploading has been started!"); }


onOriginalImagesUploadEnd()


Description:

Fires when uploading of original images is successfully completed.


Examples:

The following example shows how to handle the event on the page:

                
function EAFlashUpload_onOriginalImagesUploadEnd() { alert("Resized images uploading has been started!"); }