0 Replies Latest reply on May 19, 2009 12:06 AM by yoorazz

    State transition doesn't work first time when using external component

    yoorazz

      I noticed strange behavior when using external component with state and transition.

      When I use as Canvas with TextArea inside as a target of transition works perfectly

      When I move this target code to external MXML component the transition doesn't work for the first time, then it's ok.

      I noticed this behavior when using external components written in AS but to simplify I wrote simple MXML test application to show this:

       

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">

      <mx:states>

           <mx:State name="Details">

           <mx:AddChild relativeTo="{panel}" position="lastChild">

                <mx:target>

                   

                     <!-- this doesn't work for the first transition-->            

                     <TestBox/>

       

                 <!-- this works perfectly - TestBox.mxml has inside EXACTLY the same code as below -->

                     <!--mx:Canvas>

                          <mx:TextArea width="100"height="100"/>

                     </mx:Canvas-->

       

                </mx:target>

           </mx:AddChild>

      </mx:State>

      </mx:states>


      <mx:transitions>

      <mx:Transition fromState="*"

         toState="*">

      <mx:Resize target="{panel}"/>

      </mx:Transition>

      </mx:transitions>


      <mx:Panel title=""

        id="panel"

        horizontalScrollPolicy="off"

        verticalScrollPolicy="off">


      <mx:ControlBar>

      <mx:LinkButton id="detailsLink"

         label="Details"

         click="currentState=='Details'?currentState='':currentState='Details'"/>

      </mx:ControlBar>

      </mx:Panel>


      </mx:Application>

       

       

       

      What I'm missing?