1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Raleigh, NC
    Posts
    421
    Answers
    23
    Vote Rating
    136
    brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold

      0  

    Default Unanswered: Execute code after effect complete?

    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,732
    Answers
    109
    Vote Rating
    90
    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
    421
    Answers
    23
    Vote Rating
    136
    brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold brian428 is a splendid one to behold

      0  

    Default


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

Thread Participants: 1