Actionscript 2:MovieClipLoader.onLoadProgress 在生产中未触发

发布于 2024-07-05 05:25:25 字数 258 浏览 4 评论 0原文

我正在使用 Flash CS3,针对 Actionscript 2,并且正在编写图像预加载器。 当我在打开下载模拟的情况下测试电影时,一切正常,并且我的预加载器成功更新了我制作的下载进度条。 但是,当我将电影上传到我的网络服务器时,它几乎表现得好像 MovieClipLoader.onLoadProgress 事件直到上传结束才触发,因为电影在没有通知的情况下下载了几秒钟,然后有一个活动突然爆发,我的预加载器从 0% 快速升至 100%。 以前有人遇到过这种行为吗?如果是的话,我做错了什么?

I'm working in Flash CS3, targeting Actionscript 2, and I'm writing an image preloader. When I test the movie with the download simulation turned on everything works just fine, and my preloader successfully updates the download progress bar I've made. When I upload the movie to my web server though, it almost behaves as though the MovieClipLoader.onLoadProgress event isn't firing until the very end of the upload, because the movie sits there for several seconds downloading with no notification and then there is a sudden burst of activity and my preloader goes from 0 to 100% very rapidly. Has anyone encountered this behavior before, and if so what am I doing wrong?

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

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

发布评论

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

评论(4

刘备忘录 2024-07-12 05:25:26

经过多次测试,我最终完全重构/重写了预加载器的工作方式,这解决了我的问题。 我认为最终图像的加载和事件的触发之间存在一些滞后,实际上(由于我仍然不完全理解的原因)更新我的预加载器剪辑的代码在事件发生时没有运行已解雇,但一直等到该系列中的最后一张图像开始加载才能开始工作。 我将更新加载进度的代码从预加载器影片剪辑(查看一些 _root 级别进度变量并在输入帧上更新自身)内部移动到 onLoadProgress 事件本身。 每个发表评论的人都非常感谢你们的快速回复,一旦我达到 15 分,我就会投票赞成你们的两个答案,因为它们很有帮助,即使不完全是我正在寻找的答案。

After much testing, I ended up completely restructuring/rewriting how the preloader works, and this fixed my issue. What I thought was some lag between the loading of the final image and the firing of the event was actually (for reasons that I still don't fully understand) the code that updated my preloader clip wasn't being run as the events were being fired, but instead was waiting until the last image in the series began loading to start working. I moved the code that updates the loading progress from inside the preloader movie clip (which was looking at some _root level progress variables and updating itself on enter frame) into the onLoadProgress event itself. Everyone who commented thank you very much for the quick responses, and as soon as I reach my 15, I'll vote up both of your answers as they were helpful, if not exactly the answer I was looking for.

九公里浅绿 2024-07-12 05:25:26

感谢您的快速回复,马特。 我以前从未听说过 Charles,但它似乎是一个非常强大的工具。 出于我的目的,我还可以使用 Firefox 中的 Firebug 网络工具查看文件获取请求和进度。 Charles 和 Firebug 都显示图像已成功请求和下载,并且所有图像均在 Flash 影片出现响应并更新加载栏/触发 onLoadProgress 之前几秒钟完成。

Thank you for the quick reply Matt. I had never heard of Charles before, but it seems like an incredibly powerful tool. For my purposes I can also see the file get requests and progress using Firebug's Net tool in Firefox. Both Charles and Firebug show that the images are being requested and downloaded successfully, and all images are completed several seconds before the flash movie appears to respond and update the loading bar/fire onLoadProgress.

百善笑为先 2024-07-12 05:25:26

您在不同的浏览器中尝试过吗? 我相信Flash至少在某些情况下会使用浏览器来下载文件。 Firefox 可能会在不通知 Flash 的情况下下载文件,然后将其全部发送到 Flash。 我自己还没有看到 FF 这样做过,但有可能是某个扩展拦截了下载。

我相信我唯一一次看到像以前那样突然发生的进度是当我获得缓存副本而不是重新下载时。 但既然你看到的是实际的下载,我猜这不是你得到的。

在 IE 中尝试一下,看看是否会出现相同的行为。

Have you tried it in different browsers? I believe Flash will, at least in some cases, use the browser to download the file. It's possible Firefox is downloading the file w/o notifying Flash, and then sending it all to flash in one big burst. I haven't seen FF do this myself, but it's possible an extension is intercepting the download.

The only time I believe I've seen the progress happen in an burst like that before is when I was getting a cached copy instead of it redownloading. But since you're seeing an actual download happen I'm guessing that's not what you're getting.

Try it in IE and see if you get the same behavior.

单调的奢华 2024-07-12 05:25:25

我建议使用像 Charles (http://www.charlesproxy.com/) 这样的调试代理查看如何从您的服务器下载文件(例如,在下载开始之前是否存在高延迟,传输数据实际需要多少秒)。 这样您就可以更好地了解预加载器是否准确反映了来自服务器的数据传输。

I'd suggest using a debugging proxy like Charles (http://www.charlesproxy.com/) to see how the file is being downloaded from your server (e.g. is there a high latency before the download begins, how many seconds does it actually take to transfer the data). That way you can better see if the preloader is accurately reflecting the data transfer from the server.

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