开发者

Requesting pages and reading results with Flash

I have a Flash object hosted on foo.com开发者_运维知识库. When I run it, I want it to send a HTTP request to foo.com, and retrieve the results along with HTTP headers.

How would one achieve this with Flash? (AS 3)


You would use URLLoader to send a URLRequest to foo.com. You can add headers by pushing new URLRequestHeader's onto the URLRequest.requestHeaders array. I'm not sure about reading the headers though. I think it's possible with sockets and AIR seems to have the httpResponseStatus event (not httpStatus like the Flash API) which

unlike the httpStatus event, the httpResponseStatus event is delivered before any response data. Also, the httpResponseStatus event includes values for the responseHeaders and responseURL properties (which are undefined for an httpStatus event. Note that the httpResponseStatus event (if any) will be sent before (and in addition to) any complete or error event.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜