是否可以显示Flash文件的下载进度?

发布于 2024-09-03 18:42:31 字数 240 浏览 4 评论 0原文

我知道如何设置预加载器并且可以正常工作。但是,当我调试 Flash 应用程序并模拟下载时,它会显示空白背景,直到几秒钟过去。

我知道它正在“下载”swf 文件,我想知道是否可以为此显示进度条,或者我是否需要使 swf 文件尽可能小并预加载所需的所有内容并将所有资源作为单独的资源我获取的文件?

我发现了一些带有 ProgressEvent.PROGRESS 的内容,但这仅在 Flash 文件下载完成后加载。

I know how to setup a preloader and I have that working. But when I debug the flash application and simulate a download, it has a blank background until a few seconds have passed.

I know it is "downloading" the swf file and I'm wondering if I can show a progress bar for that, or do I need to have the swf file as small as possible and pre load everything needed and have all assets as a separate file I fetch?

I found something with ProgressEvent.PROGRESS but this only loads after the flash file is finished downloading.

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

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

发布评论

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

评论(1

2024-09-10 18:42:31

在内部,SWF 中的内容被分成帧,当 Flash 播放器加载 SWF 时,它会在加载后立即开始显示和执行帧的内容,即使后面的帧尚未完成。因此,只要您的预加载器存储在 SWF 的早期帧中,并且较重的内容存储在较晚的位置,那么显示预加载器是很有可能的。

您可能遇到的问题是,如果您以相当常见的方式构建内容,那么所有类对象都会存储在第一帧中。更改此设置的最简单方法是在 FLA 文件中的“发布设置”>“发布设置”下。闪光> AS3 设置,有一个“导出框架中的类:”对话框。如果将该设置从 1 更改为 5,那么您可以在根时间轴的前几帧上放置一个简单的预加载器(使用帧脚本),并确保使用类的所有内容都放置在第 5 帧之后的某个位置。

如果您不想在预加载器中使用框架脚本,那么也可以使用基于类的预加载器,但是您需要进入链接到类的每个对象的属性对话框,并取消选中“在框架中导出” 1" 选项,然后确保将其放置在时间线层次结构中的某个位置以确保其被导出,这有点麻烦。当然,代表预加载器的类对象仍然需要导出到第一帧。

或者,您可以对整个问题进行最终运行,并将预加载器作为单独的 shell SWF,它只需加载自身,然后加载实际内容并显示加载器栏。如果人们想重用预加载器,通常会选择此选项。

Internally, the stuff inside a SWF is separated into frames, and when the Flash player is loading a SWF, it will start displaying and executing contents for frames as soon as they're loaded, even if later ones aren't finished yet. So as long as your preloader is stored earlier in the early frames of the SWF, and your heavy contents are stored later, then showing a preloader is very possible.

The problem you're probably running into is, if you build contents in a reasonably usual sort of way, then all your class objects get stored in the first frame. The easiest way to change this is in your FLA file, under Publish Settings > Flash > AS3 Settings, there is a dialog for "Export classes in frame:". If you change that setting from 1 to, say, 5, then you can put a simple preloader (using frame scripts) on the first couple frames of the root timeline, and make sure everything using classes is placed somewhere after the 5th frame.

If you'd rather not use frame scripts in the preloader, then using a class-based preloader is also possible, but then you need to go into the properties dialog of each object that's linked to a class, and uncheck the "Export in frame 1" option, and then make sure it's placed somewhere in the timeline hierarchy to make sure it gets exported, which is all a bit more of a pain. Naturally the class object representing the preloader would still need to be exported to the first frame.

Or you can do an end-run around the whole issue, and make your preloader as a separate shell SWF, which simply loads itself, then loads the actual content and displays a loader bar. Often people choose this option if they'd like to reuse the preloader.

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