我是flex的新手,我試圖開發一個應用程序,用於上傳多個圖像文件以及每個上傳的進度條。當我們選擇並添加文件時,datagrid保存文件的名稱和每個文件的進度條。當文件上傳有進展時,它也應該反映在進度欄中。我已經使用filerefencelist保存文件的集合,當我嘗試上傳文件它生成錯誤 「空對象」在flex中生成進度條
我的代碼:
private var initDG : ArrayCollection;
private var _arrUploadFiles:Array = new Array();
private var currentFile:FileReference;
private var currentFileIndex:Number = 0;
private var uploadErrors:Array = new Array();
private var _refAddFiles:FileReferenceList = new FileReferenceList();
// function in called when upload button is clicked
// uploading file to server
private function serverFileupload(event:Event):void
{
if(! __serverSideScriptURL)
{
Alert.show("Server fileupload URL is missing. Unable to upload.");
return;
}
var request:URLRequest = new URLRequest();
request.url = __serverSideScriptURL;
request.method = URLRequestMethod.POST;
currentFile = new FileReference();
currentFile = _arrUploadFiles[currentFileIndex];
currentFile.addEventListener(IOErrorEvent.IO_ERROR, uploadIoErrorHandler);
currentFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteHandler);
currentFile.upload(request, "FileUpload", false);
}
誰能幫助我解決這個問題呢?