Is there a开发者_StackOverflow社区 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.
You need to implement a custom preloader for that. I think this tutorial can help you.
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.
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.
Try moving the HTTPRequest to a method that responds to the initialize event, like so:
initialize="getData()"
creationComplete="initApp()"
The initialize event dispatches much earlier in the application's life cycle.
精彩评论