I am loading a component which makes a HTTPService call to get data that will then be used to set certain variables in the component. I make the HTTPService call in an init() function (for the initialization event) and then set the variables according to the data received in the HTTPService result handler. However, the variables are still null at both the initialize stage and at the creationComplete stage. If I try and read the variables in a creationComp() function (for the creationComplete event), those variables are still null. Is this correct?
I guess I don't understand the flex initialization cycle very well. When are those variables actually set and available to be used? I need to manipulate those variables automatically after the component loads. Is there an event that comes after creationComplete that is appropriate or some other way to approach this? I am using Flex 3.
initialize is at the beginning of creation, creationComplete is at the end of creation.
You can create those variables at anytime, but making the HTTP service call before creationComplete will not gurantee you that they have been created yet.
I would create the variables in init, fire off my HTTP call in creationComplete and have a result handler setting the variables I created earlier. Make sure you are actually setting the variables to the recieved values.
Thanks, you were right. Turned out that I needed to put the setting variables logic in the result handler to make sure the HTTP call had been completed