Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get the Event.Complete event in a file upload to fire in Flash Builder
    text
    copied!<p>The file is getting uploaded properly and my ProgessEvent.Progress method is showing 100% complete, but my Event.Complete method does not fire. Do I have to send something specific back from the server? I am simply sending back a success message. I am not getting any errors.</p> <p>I suppose I could just proceed when the progress method hits 100%. Shouldn't the Event.Complete method be firing after the data is sent and a response is received from the server?</p> <p><em>*</em>*Update: I am getting an error with my Event.Complete method....</p> <blockquote> <p>TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::Event@1277971f1 to flash.events.DataEvent.</p> </blockquote> <p><em>*</em> I fixed the problem by changing my onLoadComplete(event:DataEvent) method to onLoadComplete(event:Event). The error went away and I my method is now firing. I will answer my own question when the system allows me to.</p> <p>Relative code follows:</p> <pre><code>fileRef = new FileReference(); fileRef.addEventListener(Event.SELECT, onFileSelected); fileRef.addEventListener(Event.COMPLETE, onUploadComplete); fileRef.addEventListener(ProgressEvent.PROGRESS,onUploadProgress); fileRef.addEventListener(IOErrorEvent.IO_ERROR, onUploadError); fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onUploadError); private function onUploadProgress(event:ProgressEvent):void { status = ((event.bytesLoaded * 100) / event.bytesTotal).toString(); } private function onUploadComplete(event:DataEvent): void { status = "Complete"; } private function onUploadError(event:Event):void { if (event is IOErrorEvent) { Alert.show((event as IOErrorEvent).text.toString()); } else if (event is SecurityErrorEvent) { Alert.show((event as SecurityErrorEvent).text.toString()); } else { status = "Unknown error"; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload