1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    498
    Vote Rating
    452
    Answers
    23
    brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future

      0  

    Default Unanswered: Execute code after effect complete?

    Hi, I'm using a simple slide out on an element:

    getElement().<FxElement>cast().slideOut( Style.Direction.UP );

    I need something to happen AFTER the effect is finished (I want to remove the element and do some cleanup). However, I can't find any way to add code or attach an event handler that will run when the slide out is done. Am I missing something?

    Thanks,

    Brian

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Vote Rating
    93
    Answers
    109
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default

    If you are using the default animation, you could set a timer at the default time, 250ms, to know that animation had finished. However, the animation methods on FxElement are each overridden to accept an Fx instance, which provides the ability to listen to the animation being canceled or ending, as well as to cancel the animation outright.

    Instead of the one line:

    Code:
    getElement().<FxElement>cast().slideOut( Style.Direction.UP );
    Create an Fx instance first, configure it, and pass it in:

    Code:
    Fx fx = new Fx();
    fx.addAfterAnimateHandler(new AfterAnimateHandler(){
      public void onAfterAnimate(AfterAnimateEvent event) {
        //handle after animation...
      }
    });
    getElement().<FxElement>cast().slideOut(Style.Direction.UP, fx);

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    498
    Vote Rating
    452
    Answers
    23
    brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future brian428 has a brilliant future

      0  

    Default

    Thank you very much, that's exactly what I was looking for! Works perfectly.

Thread Participants: 1