Multiple file uploader throwing script timeout error

Hello,

I'm loving the new flash 8 file uploading capability and have come very far w/ a multiple file uploader.

It works great most of the time but it seems to throw up the “script is causing Flash to run slowly” error about 20% of the time.

Here’s the full actionscript I am using below:


import flash.net.FileReferenceList;
import flash.net.FileReference;


//---- init ---------------------------------------------------
//-------------------------------------------------------------
//// visibility
mc_loader._visible         = false;
upload_button._visible     = false;
upload_button.enabled      = false;


var files_to_upload       = new Array();
//-------------------------------------------------------------



//---- instantiat reference list ------------------------------
//-------------------------------------------------------------
var fileRef:FileReferenceList = new FileReferenceList();
var listener = new Object();
fileRef.addListener(listener);
//-------------------------------------------------------------



//---- onSelect -----------------------------------------------
//-------------------------------------------------------------
listener.onSelect = function( fileRefList:FileReferenceList )
{
    upload_button.enabled  = true;  
    upload_button._visible = true;
    
    var list              = new Array();
    var temp_upload_array = new Array();  //var item:FileReference;
    
    list = fileRefList.fileList;
    
    for( var i:Number = 0; i < list.length; i++ )
         {
                   temp_upload_array.push( list* );      
         }
    
    files_to_upload = files_to_upload.concat( temp_upload_array );
        
}
//-------------------------------------------------------------




//---- the event for the browse buttons -----------------------
//-------------------------------------------------------------
browse_button.clickHandler = function()
{
     fileRef.browse( [ { description: "JPEGs", extension: "*.jpg;*.gif;*.png;*.tif;*.doc;*.swf;*.txt" } ] );
}
//-------------------------------------------------------------




//---- the event for the upload button ------------------------
//-------------------------------------------------------------
upload_button.clickHandler = function():Void
{
           for( var i:Number = 0; i < files_to_upload.length; i++ )
           {     
                    files_to_upload*.addListener( listener );
                 files_to_upload*.upload("https://scopeprogram.com:443/cgi-bin/upload/upload_flash.cgi");  
    }
    
}
//-------------------------------------------------------------




//---- basic listener functions -------------------------------
//-------------------------------------------------------------
listener.onCancel = function():Void {  trace("onCancel");  }


listener.onOpen = function( file:FileReference ):Void {  trace("onOpen: " + file.name);}
 

listener.onProgress = function( file:FileReference, bytesLoaded:Number, bytesTotal:Number ):Void
{
      percentLoaded = Math.round( bytesLoaded / bytesTotal * 100);                  
       _root.mc_loader.bar._xscale = percentLoaded;
       _root.mc_loader.txt_percent = percentLoaded + " % (" + _root.upload_file_cnt + ")"; //( " + Math.round( bytesLoaded ) + " of " + Math.round( bytesTotal ) + " Bytes Loaded )";    
}


//---- onComplete function ------------------------------------
//-------------------------------------------------------------
listener.onComplete = function( file:FileReference ):Void
{  
          trace( "(onComplete): file_name: " + file.name );   
}
//-------------------------------------------------------------



listener.onHTTPError = function( file:FileReference, httpError:Number ):Void
{
        trace( "onHTTPError: " + file.name + " httpError: " + httpError );
}


listener.onIOError = function( file:FileReference ):Void { trace( "onIOError: " + file.name ); }


listener.onSecurityError = function( file:FileReference, errorString:String ):Void
{
        trace("onSecurityError: " + file.name + " errorString: " + errorString);
}
//-------------------------------------------------------------

Is there anything in this code that might cause this error?

Thanks for your time,

Clem C