(如何)可以在 Flash 中实现蜗牛 HTTP(彗星/长寿命连接)吗?

发布于 2024-07-10 11:40:22 字数 240 浏览 5 评论 0原文

我对网络应用程序的流数据非常感兴趣。 我尝试过一些 javascript 库,但黑客攻击和浏览器不兼容让我发疯! HTML5 希望能够标准化流数据,但在那之前,我希望我可以借助 Flash 来在所有浏览器中实现此功能。 不幸的是,我不太熟悉 Flash 提供的所有功能。

我在Flash 8中尝试过loadVariables.onData,但它不支持流数据。 数据仅在请求完成后才可用。 有没有办法在每次返回新数据时调用函数?

I am very interested in streaming data for web-applications. I have tried out some javascript libraries, but the hacks and browser-incompatibilities drive me crazy ! HTML5 will hopefully standardize streaming data, but until then, hopefully I can resort to Flash to make this work in all browsers. Unfortunately, I'm not very familiar with all the functionality that Flash offers.

I have tried loadVariables.onData in Flash 8, but it doesn't support streaming data. The data is only available after the request has been finished. Is there any way to call a function every time new data is returned ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

手心的温暖 2024-07-17 11:40:22

虽然我不熟悉你在做什么,但听起来你应该看看 URLStream。 当您加载 Flash 直观地理解的内容(MP3、JPG、SWF 等)时,您通常会使用 Loader,然后你也可以获得进度事件,但我猜你正在谈论将任意数据加载到 ByteArray 中,而 URLStream 应该为你提供所有低您需要的级别访问权限。

假设您使用的是 AS3 和 Flash Player 9+。 我不会发誓,但我很确定你正在寻找的东西在 AS2 下是不可能的。

Though I'm not familiar with what you're doing, it sounds like you should be looking at URLStream. When you're loading things that Flash intuitively understands (MP3s, JPGs, SWFs and so on) then you would normally use a Loader, and then too you can get progress events, but I'm guessing you're talking about loading arbitrary data into a ByteArray, and URLStream should give you all the low-level access you need.

That's assuming you're using AS3, and Flash Player 9+. I wouldn't swear to it, but I'm pretty sure what you're looking for is not possible under AS2.

驱逐舰岛风号 2024-07-17 11:40:22

如果您只想流式传输单个文件,请使用 URLStream,如 fenomas 建议的那样。 如果您想要一个可以发送和接收数据的开放连接,您正在寻找的类是 XMLSocket。 应该适用于 Flash 5 之后的任何版本。

If you're just looking to stream a single file, use URLStream, as fenomas suggested. If you want an open connection that can both send and receive data, the class you're looking for is XMLSocket. Should work on anything past Flash 5.

几味少女 2024-07-17 11:40:22

正如 Moss Collum 和 fenomas 所建议的,有 URLStreamXMLSocket。 但是,如果您想在二进制级别与服务器交互,则可以使用 Socket 对象读取和写入字节。

请记住,任何网络通信都受 Flash Player 非常严格的安全模型的约束。 您可能会发现学习这一点将是非常值得的。

As Moss Collum and fenomas have suggested, there's URLStream and XMLSocket. But if you want to interact with a server on a binary level, you can read and write bytes with a Socket object.

Bear in mind that any network communication is subject to Flash Player's very rigid Security Model. You may find that learning about this will be time very well spent.

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