开发者

Flash AS3 on URLLoader.load POST - getting http status=0 and no data. Works in Flash IDE

I am making rest calls with a urlload.load(urlRquest).

also

  urlRequest.method = URLRequestMethod.POST;
  urlRequest.contentType = "application/xml";

When I make the calls within the Flash IDE, I ge开发者_如何转开发t HTTPStatusEvent.status = 400 (or whatever) when an error occurs. And the IOErrorEvent.data contains xml (or sometimes a string).

However, when I run the swf in a browser (Firefox Mac or PC), the HTTPStatusEvent.status = 0, and the IOErrorEvent.data is empty. (Interestingly in Safari Mac, I do get the 400 status, but still no data.)

Any ideas on what may be occurring? (I need my errors!)


Running the swf in Firefox will always generate a 0, since Firefox does not pass status codes to the flash player, according to the action script reference.


Likely when you're running the swf in Flash the Security.sandboxType property is localTrusted which leads to fully granted access to the outside. But when you run it in a browser it appears to be localWith....

Try to do following:

1) compile it with -use-network=true

[ADDED]

In Flash, the setting is under "Publish Settings", Flash tab. The name is "Local playback security". So you need to set it to "Access network only" before you publish a swf.

You can also switch the "-use-network" flag of a swf file after publish by using the Adobe's Local Content Updater.

[/ADDED]

2) provide access to the network in your HTML wrapper.

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100">  
  <param name="allowNetworking" value="all">  
  <param name="movie" value="moviename.swf">  
  <param name="quality" value="high">  
   <embed src="moviename.swf" width="100" height="100" quality="high"></embed>  
</object>

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜