Flash ProgressEvent 未显示总大小

发布于 2024-07-19 03:01:13 字数 352 浏览 11 评论 0原文

我在 Flash 中使用 ProgressEvent 来确定下载某些内容需要多长时间。 我有这个:

        progress = event.target.bytesLoaded/event.target.bytesTotal;

设置一个百分比。

经过一番摸索之后,我对这两个值进行了跟踪 - 结果发现“event.target.bytesTotal”始终等于零。

我在 Flex/AS3/Flash API 中找不到任何提及这一点的信息。 关于如何让 bytesTotal 工作有任何提示吗?

(我目前正在从网络服务器上的 PHP 文件中读取)

I'm using a ProgressEvent in Flash to determine how long something will take to download. I've got this:

        progress = event.target.bytesLoaded/event.target.bytesTotal;

to set a percentage.

After some scratching of my head, I did a trace on the two values - and it turns out that "event.target.bytesTotal" is always equaling zero.

I can't find any mention of this in the Flex/AS3/Flash API. Any hints on how to get bytesTotal to work?

(I'm currently reading from a PHP file on the webserver)

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

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

发布评论

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

评论(2

握住我的手 2024-07-26 03:01:13

我们通过禁用某些文件类型的压缩在服务器上解决了这个问题。

对于正在压缩的文件,bytesTotal 为 0。 这种压缩是即时发生的,这就是服务器无法给出文件大小的原因(因为它还不知道)。 删除压缩解决了它。

We've solved this issue on our server by disabling the compression of some file types.

The bytesTotal was 0 for files that were being served compressed. This compression happens on-the-fly and that is why the server cannot give the size of the file (because it doesn't know it yet). Removing the compression solved it.

他是夢罘是命 2024-07-26 03:01:13

您是否尝试过:

 progress = event.bytesLoaded/event.bytesTotal;

bytesTotal / bytesLoaded 应该是进度事件的属性。

另外...我昨天遇到了这个问题,它完全困扰了我,直到我想到检查我正在加载的文件,它最终被损坏并且为 0 字节 - 所以也请仔细检查:)

Have you tried:

 progress = event.bytesLoaded/event.bytesTotal;

bytesTotal / bytesLoaded should be a property of the progress event.

Also... I had this problem yesterday, and it totally stumped me until I thought to check the file I was loading, and it ended up being corrupt and 0 bytes - so double check that too:)

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