 	import flash.net.URLStream;
 	import flash.net.URLVariables;
 	import flash.utils.ByteArray;
+	import flash.utils.setTimeout;
 	import flash.external.ExternalInterface;
 	import com.mxi.image.events.ExifParserEvent;
 	

		 * Uploads the next chunk or terminates the upload loop if all chunks are done.
		 */
		public function uploadNextChunk():Boolean {
			var req:URLRequest, fileData:ByteArray, chunkData:ByteArray;
			var url:String, file:File = this;

			// All chunks uploaded?
			if (this._chunk >= this._chunks) {


				// Clean up memory
				file._urlStream.close();
				removeAllEventListeners();
				chunkData.clear();
			};
			file._urlStream.addEventListener(Event.COMPLETE, onComplete);

			// Delegate upload IO errors
			onIOError = function(e:IOErrorEvent):void {
				removeAllEventListeners();
				dispatchEvent(e);
			};
			file._urlStream.addEventListener(IOErrorEvent.IO_ERROR, onIOError);

			// Delegate secuirty errors
			onSecurityError = function(e:SecurityErrorEvent):void {
				removeAllEventListeners();
				dispatchEvent(e);
			};
			file._urlStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);

			// Setup URL
			url = this._uploadUrl;
