1 Reply Latest reply on May 1, 2010 2:20 PM by iamcootis

    How to get a container to creationComplete before it is brought to view

    iamcootis

      I have an application where I have a view stack like this:

       

          <mx:ViewStack id="mainViewStack" selectedIndex="{ApplicationModel.instance.viewState}" x="3" y="52" height="528">
                  <views:LessonView x="0" y="50" height="520" id="mainLessonView"/>
                  <views:ChooseLessonsView x="0" y="50" height="520" id="mainChooseLessonView"/>
                  <views:HelpView x="0" y="50" id="mainHelpView"/>
              </mx:ViewStack>

       

      The view stack starts at HelpView, from there goes to ChooseLessonView and from there to the LessonView.

       

      In the LessonView component I have preinitialized an Eventlistener that is called in the ChooseLessonView.

       

      The problem arises when the event is caught in the LessonView it tries to access a component in the LessonView that hasn't been created yet. How can I get LessonView to create itself before it is shown?

        • 1. Re: How to get a container to creationComplete before it is brought to view
          iamcootis Level 1

          I figured it out on my own using creationPolicy and creationIndex.

           

          My view stack now looks like this:

           

                  <mx:ViewStack id="mainViewStack" selectedIndex="{ApplicationModel.instance.viewState}" x="3" y="52" height="528">
                      <views:LessonView x="0" y="50" height="520" id="mainLessonView" creationPolicy="queued" creationIndex="1" />
                      <views:ChooseLessonsView x="0" y="50" height="520" id="mainChooseLessonView" creationPolicy="queued" creationIndex="3"/>
                      <views:HelpView x="0" y="50" id="mainHelpView" creationPolicy="queued" creationIndex="2"/>
                  </mx:ViewStack>