在 Actionscript 2 中,如何从 XML 对象获取 302 重定向?
我正在开发一个 Actionscript 2 项目 - 尝试使用 XML 对象来查找作为 302 重定向返回的 url。 有没有办法在 ActionScript 2 中做到这一点?
代码:
var urlone:XML = new XML();
urlone.load("http://mydomain.com/file.py");
urlone.onLoad = function (success) {
trace("I want to print the 302 redirect url here, how do I access it?");
};
I am working on an Actionscript 2 project - trying to use the XML object to find a url which is returned as a 302 redirect. Is there a way to do this in actionscript 2?
code:
var urlone:XML = new XML();
urlone.load("http://mydomain.com/file.py");
urlone.onLoad = function (success) {
trace("I want to print the 302 redirect url here, how do I access it?");
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为从 AS2 来看这是不可能的,我认为浏览器会自动重定向到新的 URL & 只需从该 URL 返回数据即可。 可能在AS3中,他们添加了几个新的功能比如读取HTTP headers等等。
也许您应该做的不是返回 302 重定向,而是以文本字符串形式返回 URL。 这样就可以很容易地从 Flash 中读取数据,只需使用 .onData 而不是 .onLoad,这样它就不会尝试解析 XML。
I don't think it's possible from AS2, I think the browser will redirect to the new URL automatically & just return the data from that URL. It may be possible in AS3, they added several new features such as reading HTTP headers and so on.
Perhaps what you should do is instead of returning a 302 redirect, just return the URL as a text string. Then it would be easy to read from within Flash, just use .onData instead of .onLoad so it doesn't try to parse the XML.
我认为这是不可能的(至少使用 XML 类)。 它有一个 onHTTPStatus 事件处理程序,但似乎即使这样,您也只能访问状态代码而不能访问其他内容。
I don't think it's possible (at least using the XML class). It has an onHTTPStatus event handler but it seems that even with that, you'll only be able to access the status code and nothing else.