Question
multi events (addlistener(list[i])) how ?
Hello their,
I searched the whole Internet for tutorials on how to make multi events ... and couldn't find anything related to that, so I thought their must be someone here can help me out :)
I'm trying to make multi files upload thing, I'm using FileReferenceList object, I have button called (Browse) whenever you click and choose files a new FileReferenceList is created and added to fileList:array
[PHP]submitBrowse.onPress = function()
{
var i:Number = fileList.length;
fileList = new FileReferenceList();
fileList.browse(allTypes);
trace('submit end ' + fileList.length + ":" + i);
}[/PHP]
Now I have few events like below.
[PHP]listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}[/PHP]
Now when someone click on upload, the code runs as below.
[PHP]submitRemove.onPress = function()
{
trace(fileList.length);
for(var i=0; i<fileList.length;i++)
{
fileList .addListener(listener);
var list:Array = fileList .fileList;
var item:FileReference;
for(var l:Number = 0; l < list.length; l++) {
item = list;
trace(item.name);
item.upload("progress.php");
}
}
}[/PHP]
Now everything seems somehow working but the event (listener.onComplete) never occer even if I added it like this fileList .addListener(listener);, which I feel is incorrect?
Thats my problem and I hope someone can tell me how to fix it :)
Thanks in advance for your kind help :)
//HW2002
I searched the whole Internet for tutorials on how to make multi events ... and couldn't find anything related to that, so I thought their must be someone here can help me out :)
I'm trying to make multi files upload thing, I'm using FileReferenceList object, I have button called (Browse) whenever you click and choose files a new FileReferenceList is created and added to fileList:array
[PHP]submitBrowse.onPress = function()
{
var i:Number = fileList.length;
fileList = new FileReferenceList();
fileList.browse(allTypes);
trace('submit end ' + fileList.length + ":" + i);
}[/PHP]
Now I have few events like below.
[PHP]listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}[/PHP]
Now when someone click on upload, the code runs as below.
[PHP]submitRemove.onPress = function()
{
trace(fileList.length);
for(var i=0; i<fileList.length;i++)
{
fileList .addListener(listener);
var list:Array = fileList .fileList;
var item:FileReference;
for(var l:Number = 0; l < list.length; l++) {
item = list
trace(item.name);
item.upload("progress.php");
}
}
}[/PHP]
Now everything seems somehow working but the event (listener.onComplete) never occer even if I added it like this fileList .addListener(listener);, which I feel is incorrect?
Thats my problem and I hope someone can tell me how to fix it :)
Thanks in advance for your kind help :)
//HW2002