开发者

How to initialize some variables after creationComplete event is dispatched in Flex

开发者 https://www.devze.com 2023-02-15 02:54 出处:网络
I tried to send some services to fetch data in the creationComplete handler. Then I need to process the server开发者_开发百科 raw data before displaying some sub-components. Where should I put this ki

I tried to send some services to fetch data in the creationComplete handler. Then I need to process the server开发者_开发百科 raw data before displaying some sub-components. Where should I put this kind of code?


First off, I use Mate as my application framework. It definitely helps in situations like this.

When I've needed to do this kind of thing in the past I would make my service call in my creationComplete handler and dispatch a custom event once all my data has been processed and distributed to my sub components' presentation models.

After the data was bound to all of my sub components I set their visibility to true or add them to the app, depending on what needed to happen.


You can already call services on the preinitialize method of your Application but it doesn't mean you will get your results before the creationComplete is dispatched.

If you want to display subcomponents after you get the results, I suggest you to have a look at Flex states. Or you can play with the visible property of you components. Sometimes it's enough to get what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消