private var _remselbutton:Button;
private var _remallbutton:Button;
private var _uploadbutton:Button;
private var _progressbar:ProgressBar;
private var _testButton:Button;
//DataGrid Columns
private var _nameColumn:DataGridColumn;
private var _typeColumn:DataGridColumn;
private var _sizeColumn:DataGridColumn;
private var _creationDate:DataGridColumn;
private var _modificationDate:DataGridColumn;
private var _progressColumn:DataGridColumn;
private var _columns:Array;
//File Reference Vars
[Bindable]
private var _files:ArrayCollection;
private var _fileref:FileReferenceList
private var _file:FileReference;
private var _uploadURL:URLRequest;
private var _totalbytes:Number;
//File Filter vars
private var _filefilter:Array;
//config vars
private var _url:String; // location of the file upload handler can be a relative path or FQDM
private var _maxFileSize:Number; //bytes
private var _variables:URLVariables; //variables to passed along to the file upload handler on the server.
//Constructor
public function MultiFileUpload(
dataGrid:DataGrid,
browseButton:Button,
removeAllButton:Button,
removeSelectedButton:Button,
uploadButton:Button,
progressBar:ProgressBar,
url:String,
variables:URLVariables,
maxFileSize:Number,
filter:Array
){
_datagrid = dataGrid;
_browsebutton = browseButton;
_remallbutton = removeAllButton;
_remselbutton = removeSelectedButton;
_uploadbutton = uploadButton;
_url = url;
_progressbar = progressBar;
_variables = variables;
_maxFileSize = maxFileSize;
_filefilter = filter;
init();
}
//Initialize Component
private function init():void{
// Setup File Array Collection and FileReference
_files = new ArrayCollection();
_fileref = new FileReferenceList;
_file = new FileReference;
// Set Up Total Byes Var
_totalbytes = 0;
// Add Event Listeners to UI
_browsebutton.addEventListener(MouseEvent.CLICK, browseFiles);
_uploadbutton.addEventListener(MouseEvent.CLICK,uploadFiles);
_remallbutton.addEventListener(MouseEvent.CLICK,clearFileCue);
_remselbutton.addEventListener(MouseEvent.CLICK,removeSelectedFileFromCue);
_fileref.addEventListener(Event.SELECT, selectHandler);
_files.addEventListener(CollectionEvent.COLLECTION_CHANGE,popDataGrid);
// Set Up Progress Bar UI
_progressbar.mode = "manual";
_progressbar.label = "";
// Set Up UI Buttons;
_uploadbutton.enabled = false;
_remselbutton.enabled = false;
_remallbutton.enabled = false;
// Set Up DataGrid UI
_nameColumn = new DataGridColumn;
_typeColumn = new DataGridColumn;
_sizeColumn = new DataGridColumn;
_nameColumn.dataField = "name";