Search code examples
actionscriptflex3mxmlcomponents

flex 3 play effect removedFromStage


I'm removing a component from the WindowedApplication, using removeChildAt(), and want to play an effect (defined within the component, say mx:Resize) which reduces the height of the component (an hbox) to 0 before it is removed.

I was using the removedFromStage event within the component, but it just disappears (without playing the effect). I guess it's being removed before the effect is played. Is there a way to play the effect, which is preferably defined in the component, before the removeChild function completes?

Thanks.


Solution

  • I moved the effect to the parent so:

    var contentBox:VBox = new VBox();
    var cm:HBox = new Hbox();
    cm.setStyle('removedEffect', CloseDown);
    contentBox.addChildAt(cm, 0);
    //in another function
    contentBox.removeChild(0);
    

    This works. When I had the effect in the component itself, this didn't work, alas.