在 Flash/AS3 中使用 Loader.load() 函数时是否出现挂起或滞后?

发布于 2024-11-29 11:38:49 字数 381 浏览 1 评论 0原文

我创建了一个简单的图像列表,每 60 秒重新加载一次。然而,我注意到,当重新加载过程开始时,Flash 似乎挂起或至少根本不接受/记住任何鼠标输入。

具体来说,虽然它被认为是冻结的,但我尝试单击一个按钮来执行其通常的功能,目前该功能仅显示鼠标按下状态,但直到假定的冻结结束后它才会注册单击。这导致我不得不再次点击。

我真的需要知道,如果我加载 5 个小 png 图像(循环调用 load() 5 次),这是否会导致 Flash 挂起并忽略任何鼠标输入或者我说疯了,应该在其他地方寻找问题。

我知道 Flash 不是多线程的,但调用 load() 肯定不会导致整个应用程序自行关闭 100-200 毫秒?

非常感谢您的任何意见,谢谢。

I have created a simple list of images that are to be reloaded every 60 seconds. However, I have noticed that when the reloading process begins, Flash seems to hang or at least doesn't accept/remember any mouse input at all.

Specifically, while it's supposedly frozen I try click a button to perform it's usual function, which at the moment is just showing the mouse down state, but it doesn't register the click until afte the supposed freeze is over. Which results in me having to click again.

I really need to know, if I am loading say 5 small png images (calling load() 5 times in a loop) would this cause Flash to hang and ignore any mouse input or am I talking crazy and should be looking elsewhere for the problem.

I understand Flash isn't multi-threaded but surely calling load() doesn't cause the whole application to just shut itself off for a 100-200 milliseconds?

Any input is greatly appreciated, thank you.

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

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

发布评论

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

评论(3

人心善变 2024-12-06 11:38:49

回应您的评论:

除了说 Loader 对象实际上加载了 swf 或某种类型的显示对象,然后 flash 在内部修改二进制数据,然后在内部解析 SWF 或位图类型并渲染之外,无法给出更多明确的证据它到 Loader 对象内的 .content 显示对象。不必介意在这一切之前调度获取二进制数据的 URL 请求。加载对象的后台发生了很多事情。如果您想要有关二进制数据修改的证据,只需加载图像,然后将字节从加载器中复制出来并将其保存在某个地方。然后与原始数据进行比较。您将在那里看到修改,事实上,如果您将输出字节保存回图像并尝试使用图像查看器打开它,它将不起作用,这也是修改的证明。除此之外,您可以发布一个到 SWF 的链接,并让其他人在这里测试它,以确认同样的事情发生在他们身上,我确信它会发生。这就是您将获得的最多证据,因为与 Loader 或显示对象相关的任何代码都是闭源代码,并且不包含在 Tamarin 项目(Flash VM 的开源部分)中。

In response to your comment:

Can't give anymore definite proof other than to say that the Loader object actually loads a swf or some type of display object and then flash internally modifies the binary data, then internally parses the SWF or bitmap type and renders it to the .content display object within the Loader object. Nevermind dispatching the URL request that fetches the binary data before all this. There is a lot going on in the background of the loader object. If you want proof about the modification of the binary data just load an image, then copy the bytes out of the loader and save it somewhere. Then compare against the original data. You'll see the modification there and in fact if you save the output bytes back to an image and try to open it with an image viewer, it won't work this is also proof of the modification. Other than that, you could post a link to the SWF and have others here test it to confirm the same thing happens to them, which I'm sure it will. That's about the most amount of proof you're gonna get since any code related to the Loader or display objects is closed source and not included in the Tamarin project, the open source portion of the flash VM.

贱贱哒 2024-12-06 11:38:49

关于冻结 - 请阅读 LoaderContext#imageDecodingPolicy 并参见此处 http://www.bytearray.org/?p=第2931章

Regarding freezing — read about LoaderContext#imageDecodingPolicy and see here http://www.bytearray.org/?p=2931

回答我自己的问题,不,没有滞后或挂起。 Flash 设法很好地处理所有事情,事实证明您在使用 MouseEvent.CLICK 时应该小心,因为如果您在鼠标按下之后但在鼠标按下之前在重新加载期间交换图像对象,则 Flash 会获胜不要调度 click 事件,因为您没有在同一对象上引起 mousedown 和 mouseup。这显然让我觉得有延迟,因为 Flash 似乎没有记录我的鼠标点击。

感谢所有尝试解决该问题的人。

To answer my own question, no there is no lag or hang. Flash manages to handle everything nicely it just turns out that you should watch out when using MouseEvent.CLICK because if you swap the image object during a reload after you have done a mousedown but before a mouseup, flash won't dispatch the click event as you haven't caused a mousedown and mouseup on the same object. Which apparantly made me think there was a lag as it seemed Flash didn't register my mouse click.

Thanks to all that tried to resolve the issue.

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