问题描述
我读过这个多的例子,但我只是不明白它是如何工作的。
- 如何类知道它的的在的pre-装载机?
- 如何闪存知道加载一个类,但不是其他?
- 在我多少钱可以做一个preloader? :磷
我使用的是FlashDevelop大气压,它的发电项目,我 - 然而,所有我检查,他们没有解释它是如何工作要么例子
您熟悉Flash时间表?
默认情况下,SWF将有一帧。这个框架包含您的preloader.as类。在编译时,FD创建第二个框架,其中包含主类 - 来运行你想要的类,一旦整个SWF已下载。preloader.as包含code,它等待,直到所有的帧都已经完全下载,然后实例化的主类。
从 http://www.flashdevelop.org更多细节/community/viewtopic.php?f=9&t=5398 :
闪存知道先运行preloader.as因为FD所说的那样在第一帧,而FD做到这一点,因为preloader类已设置为始终编译(你可以选择设置这个选项自己通过右键单击一个类,然后选择始终编译)。
您可以做任何你喜欢的preloader,但它不会运行任何其code,直到需要的preloader已下载的一切。所以,如果你犯了一个preloader有3MB的图像文件和一个进度条,进度条将不会做任何事情,直到整个图像已经下载了!
I've read multiple examples on this, but I just don't get how it works.
- How does the class know it's THE pre-loader?
- How does flash know to load one class but not another?
- How much can I do in a preloader? :-p
I'm using FlashDevelop atm and it's generating the project for me - however, from all the examples I checked they didn't explain how it worked either.
Are you familiar with the Flash timeline?
By default, your SWF would have one frame. This frame contains your Preloader.as class.At compile-time, FD creates a second frame, which contains your Main class -- the class you want to be run once the whole SWF has downloaded.Preloader.as contains code that waits until all frames have been fully downloaded, and then instantiates the Main class.
More details from http://www.flashdevelop.org/community/viewtopic.php?f=9&t=5398:
Flash knows to run Preloader.as first because FD puts it in the first frame, and FD does this because the Preloader class has been set to "Always Compile" (you can choose to set this option yourself by right-clicking a class and selecting "Always Compile").
You can do whatever you like in a preloader, but it won't run any of its code until everything needed by the preloader has downloaded. So if you make a preloader with a 3MB image file and a progress bar, the progress bar won't do anything until the entire image has downloaded!
这篇关于如何在AS3的preloader工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!