Flex 4 - 需要一些有关启动进度的帮助
有没有办法将我的 HTTPServices 包装到启动进度中?现在我已经为应用程序上的creationComplete 设置了HTTPRequest Send 操作(应用程序creationComplete="initApp()")。有没有办法让它们作为初始启动和进度条的一部分?这样当进度条完成时,所有数据都会被加载。
Is there a way to wrap my HTTPServices into the startup progress? Right now I have the HTTPRequest Send actions set for creationComplete on the Application (Application creationComplete="initApp()"). Is there a way to have them as part of the initial startup and progress bar? This way all the data will be loaded when the progress bar is complete.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要为此实现一个自定义预加载器。我认为本教程可以提供帮助你。
You need to implement a custom preloader for that. I think this tutorial can help you.
您可以尝试将 HTTPServices 调用与主应用程序的
preinitialize
事件联系起来。查看这篇文章有关 Flex 启动顺序的更多信息。
You could try tying your HTTPServices call to the
preinitialize
event of the main Application.Check out this article for more info on the Flex startup order.
康斯坦丁的建议是正确的。您应该阅读我关于如何制作自定义预加载器。本教程的重点不是如何设置预加载器的外观,而是如何包含在 Flex 应用程序预加载期间发生的自定义耗时操作。
本教程还包括更新的 Flex 4 示例,该示例演示了您应该在何处插入服务调用。
在您的特定情况下,您需要等待 Flex 框架加载,然后才能使用 HTTPService,因为 HTTPService 类是框架的一部分。
Constantiner's suggestions is correct. You should read my tutorial on how to make a custom preloader. The focus in the tutorial is not on how to skin the preloader, but on how to include a custom time-consuming actions to take place during the preloading of the Flex application.
The tutorial includes also an updated Flex 4 sample that demonstrates where you should plug your service call.
In your particular case you need to wait for the Flex framework to load before using the HTTPService, because the HTTPService-class is part of the framework.
尝试将 HTTPRequest 移至响应初始化事件的方法,如下所示:
初始化事件在应用程序生命周期的早期调度。
Try moving the HTTPRequest to a method that responds to the initialize event, like so:
The initialize event dispatches much earlier in the application's life cycle.