Flash/AS3 - 并发 URLLoader.load() 请求的数量是否有限制?

发布于 2024-10-22 06:45:26 字数 289 浏览 6 评论 0原文

所有,

我正在开发一个 Flash/AS3 项目,该项目发出大量 URLLoader.load() 请求。

我应该对它们进行排队,以便任何时候只有一个打开的请求吗?或者,允许多个打开请求是一个好习惯吗?

开放请求的数量有限制吗?

(我假设我可以管理用户界面中的影响)。

我已经在本地运行了最多 5 个并发请求的测试,并且效果很好。但我需要确保该应用程序能够在现场运行,适用于使用旧电脑、旧浏览器、具有多个打开选项卡的浏览器等的用户。

提前非常感谢您的任何建议和见解!

All,

I'm working on an Flash/AS3 project that makes numerous URLLoader.load() requests.

Should I queue them so that there's only a single open request at any time? Or, is it a good practice to allow multiple open requests?

Is there a limit to the number of open requests?

(I'm assuming I can manage the implications in the UI).

I've run tests locally with up to 5 simultaneous requests, and it works just fine. But I need to make sure the application will work in the field, for users with older PCs, older browsers, browsers with multiple open tabs, etc.

Many thanks in advance for any advice and insight!

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

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

发布评论

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

评论(3

和影子一齐双人舞 2024-10-29 06:45:26

很久以前,当我尝试加载大量图像时,我遇到了这个问题。它们都是本地的,所以我只是用装载机将它们排队。队列时间调试为什么图像为空:S

我不确定是否在任何地方提到了限制,但我发现(如果没记错的话)大约 30 给我带来了问题。之后,我认为它将重用旧连接:因此,如果您有 100 个 load() 调用,则只会加载最后 30 个左右。

通常我一次会排队大约 10 个,然后在完成后加载其余的。多个连接并没有真正的问题 - 尽管它们会开始占用 CPU 功率等。

如果您想忽略这一点,请查看类似 BulkLoader 的内容:http://code.google.com/p/bulk-loader/ 是为此创建的

I ran into this problem ages ago when I was trying to load a ton of images. They were all local, so I just queued them up with the Loader. Queue hours debugging why images were null :S

I'm not sure if the limit is mentionned anywhere, but I found (if memory serves) around 30 was giving me problems. After that and I think it would reuse old connections: so if you have 100 load() calls, only the last 30 or so would be loaded.

Normally I queue up about 10 at a time, then load in the rest as they get completed. There's no real problem with multiple connections - though they will start to take up CPU power etc.

If you want to just ignore this, check out something like BulkLoader: http://code.google.com/p/bulk-loader/ which was created for this

放飞的风筝 2024-10-29 06:45:26

我不知道这是否有任何硬性限制,但 5 个同时请求听起来很合理。
我知道大多数浏览器同时使用 6 个连接,这可能也是 Flash 的限制。

我会使用 5 个加载器之类的东西,并对超出此范围的所有加载事务进行排队。

I don't know if there is any hard limit on this, but 5 simultaneous requests sounds quite reasonable.
I know that most browsers use like 6 simultaneous connections, and probably that is the limit for Flash too.

I would use something like 5 loaders, and queue all loading transactions that go beyond that.

浮萍、无处依 2024-10-29 06:45:26

这个问题是很久以前的问题了。我从谷歌来到这里,但谢谢你的答案。

事情可能已经改变了。我只是在 Flex 4.6 和 AS 3 上测试重用 URLLoader.load。

这里有一个棘手且未记录的限制。加载器可以重用,但在一次回调中仅发出最后一个请求。

前任。

timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, timerHandle);
timer.start();
var loader:URLLoader = new URLLoader(); // and need to add listeners for response

function timerHandle(e:TimerEvent):void {
    loader.load(certainURLRequest);
}

这很好用。但下面的方法却没有。

function timerHandle(e:TimerEvent):void {
    loader.load(firstURLRequest); // this request didn't get issued
    loader.load(secondURLRequest); // this request got sent
}

我不知道内部情况。这可能和ActionScript的单线程EventLoop方式有关,回调返回后会处理请求,最后一个会覆盖前一个。这一切都是我的猜测。

希望这对来到这里的追随者有所帮助。

This question was long ago. I came here from Google but thank you for the answers.

Things might have changed. I just test reusing URLLoader.load on Flex 4.6 and AS 3.

There's a tricky and undocumented limit here. The loader can be reused but only the last request got issued in once of callback.

ex.

timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, timerHandle);
timer.start();
var loader:URLLoader = new URLLoader(); // and need to add listeners for response

function timerHandle(e:TimerEvent):void {
    loader.load(certainURLRequest);
}

this works well. But the way below doesn't.

function timerHandle(e:TimerEvent):void {
    loader.load(firstURLRequest); // this request didn't get issued
    loader.load(secondURLRequest); // this request got sent
}

I dont' know the internals. This might relate to the single-thread EventLoop way of ActionScript, where the request will be processed after returning from the call back and the last one overwrites the previous. It is all my guess out.

Hope this helps the followers coming here.

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