开发者

Flex app to load data before anything else

I have a flex app that takes data from a back end database then displays the content in one of 3 views. These views are all in a viewstack which is instantiated in main.mxml The method to get the data (remote object)is also in main.mxml.

The views rely on the data so how can I go about making sure that the data is loaded first before any开发者_开发技巧 of the views in viewstack are created / initialised to stop me having null reference errors?


When you get the data, you should have a callback function defined to receive that data (callback function is the function you put into addEventListener). You just need to call the function to create your viewstack after all your callbacks have been called.

The way I would do it is create an class field called numCallbacks. Increment this variable everytime one of your callbacks is called. Right after you increment it, check if numCallbacks == the number of callbacks you have. If true, create your view stack.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜