0
votes

While trying to sort out a problem with loading components and firing events based on that, I came across a question for which I could not find an answer online.

Following is a sample of reference code

<s:WindowedApplication>

    <s:states>
        <s:State name="login"/>
        <s:State name="data"/>
    </s:states>

    <s:VGroup id="login" includeIn="login">
        <s:HGroup id="loginHGroup">
        </s:HGroup>
    </s:VGroup>

    <s:VGroup id="data" includeIn="data">
        <s:VGroup id="v1">
            <s:HGroup id="h11">

            </s:HGroup>
            <s:HGroup id="h12">

            </s:HGroup>
        </s:VGroup>

        <s:VGroup id="v2">
            <s:HGroup id="h21">

            </s:HGroup>
        </s:VGroup>
    </s:VGroup>
</s:WindowedApplication >

Now if I want to fire an event after the last UI component 'data' state gets created - which element do I fire it off from? Will HGroup h12 get created first or h21? What is the flow of element creation in Flex - does it follow DOM schematics or is there some other mechanism?

[Remember that I cannot fire creationComplete at WindowedAPplication level as that is going to get fired when the login state is created].

1
The outermost component will be the last to fire its creationComplete event, but if you want to know when the state is finished changing, use currentStateChange. - RIAstar
I think it is the other way around, the inner most child fires the creationComplete and it follows up the container hierarchy. - Zeus

1 Answers

1
votes

Always the outer component is the last one to fire the creationcomplete event, so, you can add creation complete event listener on the application, or You can even add the applicationComplete event on the application which occurs after the creation complete.