Flex 预加载器必须可见,直到加载其他外部文件
我有一个 Flex 应用程序,可以从数据库加载一些数据。在此期间,我希望我的自定义预加载器保持可见。
困境是:当我在 FlexEvent.INIT_COMPLETE
处理程序中推迟 dispatchEvent(new Event(Event.COMPLETE))
时,加载永远不会发生,因为下一帧不存在进入。
如何保持加载程序运行直到所有数据完全加载?
I have a Flex application that loads some data from the database. During this I want my custom preloader stay visible.
The dilemma is: When I postpone the dispatchEvent(new Event(Event.COMPLETE))
in the FlexEvent.INIT_COMPLETE
handler, the loading will never happen because the next frame is not entered.
How can I keep the loader running until all the data is fully loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
预加载器基本上是一个精灵。所有 Flex 组件都会扩展精灵,因此您实际上可以轻松地继续使用精灵。我不确定覆盖应用程序框架中删除预加载精灵的部分有多困难。但是,我认为您可以使用自定义组件将精灵添加回舞台。
您可能必须创建一个 UIComponent 并添加预加载器组件,以便可以将其与状态一起使用。然后将您的新 UIComponent 设置为默认状态。
以下是我的“伪”代码。
然后在您的应用程序中
,当您完成后,将应用程序的 currentState 更改为预加载。您可能需要重写 UIComponent 中的更多方法才能使其正常工作。
A preloader is basically a sprite. All flex components extend sprites so you can actually continue to work with sprites pretty easily. I'm not sure how difficult it would be to override the part of the application framework that REMOVES that pre-loader sprite.. however, I think you can add the sprite back to the stage... using a custom component .
You probably have to create a UIComponent and add your preloader component so that you can use it with states. Then set your NEW UIComponent to the default state.
The following is "psuedo" code off the top of my head.
Then in your app
Now when you're done change the currentState of the app away from pre-loading. You may need to override a few more methods in UIComponent to get it working right.