我正在将纯 as3 环境转移到 Flex 中,并且我有一个关于预加载器的问题。
对于我的一个应用程序,特别是当 swf 加载时,我会添加一个带有动画预加载器的屏幕。然后,在我的代码中的某个特定点,当我知道我的所有 xml 都已被解析、UI 已构建且所有初始化已完成时,我会调度一个“完成”事件来删除预加载器。
我怎样才能实现这一点呢?我只见过基于百分比的 Flex 预加载器,我相信它代表了 swf 本身的实际加载?
I'm moving to a pure as3 environment into flex and I have a question about preloaders.
For one of my apps in particular when the swf loaded I would add a screen with an animated preloader. Then at a particular point in my code when I know all of my xml has been parsed, UI built and all initiliztion done I dispatch a "done" event which removes the preloader.
How can I achieve this is flex? I've only ever really seen flex preloaders that are percentage based which I believe represent the actual loading of the swf itself?
发布评论
评论(3)
请阅读预加载器的 Flex 食谱,他们有一些演示应用程序,可以帮助您,
实际上应用程序标签中有一个预加载器属性,
这可能是您可以帮助您的
tc
安库尔·夏尔马
Please read the flex cookbook for preloaders, they have some demo applications, that could help u out
actually there is a preloader property in the application tag,
that could be wht u might help u out
tc
Ankur Sharma
Flex 有一个 ProgressBar 控件,您可以使用它来类似的目的。如果您想继续使用自己的自定义动画进度条,可以将该
Sprite
添加到容器(最好是Canvas
)的rawChildren
中并使用PopUpManager
将其显示为模式弹出窗口 - 从done
事件处理程序中删除弹出窗口。如果您传递不扩展
UIComponent
的子级,则Container
类的重写addChild
方法将引发错误 - 这就是您应该使用的原因rawChildren.addChild
。Flex has a ProgressBar control that you can use for similar purposes. If you want to continue to use your own custom animated progress bar, you can add that
Sprite
to therawChildren
of a Container (preferablyCanvas
) and show it as a modal pop-up using thePopUpManager
- remove the pop-up from thedone
event's handler.The overriden
addChild
method of theContainer
class will throw an error if you pass a child that doesn't extendUIComponent
- that's why you should userawChildren.addChild
.是的,默认的 Flex 预加载器代表 swf 本身的加载。
如果我是你,我会使用任务来自 Cairngorm 3 Libs 的库与预加载器完美配合:
http://opensource.adobe.com/svn/opensource/cairngorm3/trunk/libraries/TaskTest/src/samples/TaskFlowPreloader.as
Yep default flex preloader represents the loading of the swf itself.
If I were you, I would use the Task library from the Cairngorm 3 Libs, works perfectly with a preloader :
http://opensource.adobe.com/svn/opensource/cairngorm3/trunk/libraries/TaskTest/src/samples/TaskFlowPreloader.as