开发者

as3 to .net, not receiving Event.COMPLETE callback

I created an image uploader for an app I am working on. I first used php for the server side script, and everything worked fine. I found out afterwards I had to use .net, so I created new serverside scripts. The problem I am having is that my event.COMPLETE listener is never firing. I can receive data back using a DATAEVENT listener, but then it stops at this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.

Here is how I am sending my file.

var fileRefReq:URLRequest = new URLRequest(FILE_UPLOAD_TEM开发者_如何学GoP);
                var fileReqVars:URLVariables = new URLVariables();
                fileReqVars.subdir = "Temp";
                fileRefReq.data = fileReqVars;
                fileRefReq.method = URLRequestMethod.POST;
                fileRef.upload(fileRefReq);

The file definitely gets uploaded to the first TEMP directory, but then it breaks with the above error.

Has anyone else had a similar problem or point me in the right direction for solving this?


This is an error produced by Flash. The most common causes are:

  1. It could be a 404 Error you are getting somewhere in the Flash.

  2. This error can occur if you close the browser while it is loading something.

  3. By default, the calling SWF file and the URL you load must be in the same domain. For example, a SWF file at www.adobe.com can load data only from sources that are also at www.adobe.com. To load data from a different domain, place a URL policy file on the server hosting the data.

Number 3 is important because a common user problem with Flash is security issues - so it is just something to rule out. Most likely not the cause here.

I would test for these 3 causes and read over the URLRequest: http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html

After some additional thought I think it is timing out but that is just a theory. Add an event listener like so:

urlLoader.addEventListener("httpResponseStatus", function(event:HTTPStatusEvent):void

to see what is actually happening.


You have to handle the event such as:

// add the event listener
urlLoader.addEventListener( IOErrorEvent.IO_ERROR, onErrorHandler );

// handle the error event like this:
private function onErrorHandler( e: IOErrorEvent ): void {
 trace( "An io error occurred." );
}

Hope that helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜