1 Reply Latest reply on Jun 28, 2006 4:53 PM by njadobe

    Example of RemoveChildAction

    leotemp Level 1
      I am using flex 2 Beta 3 -
      I am attempting to animate a canvas in a transition and then remove it from the screen after the animation ends so its not just sitting on the screen in its final animation state. I am scaling the canvas and a small example of the logic im using is below:

      <mx:Sequence>
      <mx:Parallel>
      <mx:AnimateProperty target="{elementID}" property="scaleX" fromValue="1" toValue="4" duration="500"/>
      <mx:AnimateProperty target="{elementID}" property="scaleY" fromValue="1" toValue="4" duration="500"/>
      <mx:Dissolve target="{elementID}" alphaFrom=".35" alphaTo="0.0" duration="500"/>
      </mx:Parallel>
      <mx:RemoveChildAction target="{elementID}"/>
      </mx:Sequence>

      As i said the transition works fine and the animation is exactly as i want it but the element that is animated is never removed :(

      Thanks to everyone thats anwered my questions before, you have allways been professional no matter how stupid my question was!

      leo
        • 1. Example of RemoveChildAction
          njadobe
          Hi,

          Are you using this effect in the context of a transition that runs on a state change? I believe RemoveChildAction only works when you're changing states, and the item is actually being RemoveChild'ed in the state you're changing to.

          If you're using states, could you post the code for the states themselves (the contents of the <mx:states> tag)?

          If you're not using states and want the behavior you describe, you could handle the effectEnd event on the outer Sequence:

          <mx:Sequence effectEnd="removeChild(elementID);">
          ...
          </mx:Sequence>

          Or, if you just want to make it invisible without actually removing it, you could do "removeChild.visible = false".

          Hope this helps,

          nj
          Flex Builder team