私はこれを使用します:
private function _addFileListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.OPEN, this._handleFileOpen);
dispatcher.addEventListener(Event.SELECT, this._handleFileOpen);
dispatcher.addEventListener(Event.CANCEL, this._handleFileCancel);
dispatcher.addEventListener(ProgressEvent.PROGRESS, this._handleFileProgress);
dispatcher.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,this._handleFileComplete);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, this._handleError);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this._handleError);
}
ここで、「dispatcher」はファイルです。
for (var i:uint = 0; i < fileList.length; i++) {
file = FileReference(fileList[i]);
this._addFileListeners(file);
this._pendingFiles.push(file);
}
およびサンプル ハンドラー:
private function _handleFileOpen(e:Event):void {
var file:FileReference = FileReference(e.target);
...
}
同じ名前の 2 つのファイルをどのように区別したいのかわかりません。私の場合、ファイルをキューで送信します。そのため、一度にアップロードされるファイルは 1 つだけです。(保留中のファイル)。