在 Actionscript 2 中,如何从 XML 对象获取 302 重定向?

发布于 2024-07-07 06:19:40 字数 328 浏览 5 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡忘如思 2024-07-14 06:19:40

我认为从 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.

坐在坟头思考人生 2024-07-14 06:19:40

我认为这是不可能的(至少使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文