3 Replies Latest reply on Mar 18, 2014 7:29 AM by wittnl

    Callback function as soon as animation complete


      Hi all,


      My question is very straight forward:


      I would like to fire up a function as soon as a symbol has finished playing, and i would like to write the code in the stage event.


      Ive created a very simple exmple for the matter:


      I have two symbols each with a very simple animation taking them out of the screen, and each with a trigger on 0ms - sym.stop();

      I start rect1 animation in the stage event and i would like to call a callback function as soon as rect1's playback is complete.


      screensohts attached:




      I think a lot of people would like to see a sulotion to this issue.


      thank you!


        • 1. Re: Callback function as soon as animation complete

          I am not sure if i understand you correctly, but if I do then you just want to fire your second animation, when the first one ends right? Why donmt you use a trigger at the end of your Animation and use it to initiate the second one?

          Or is there another reason that we don't know about till now, why you want to start it from your stage code?



          I hope it helps somehow,

          Have a beautiful day and good luck,


          • 2. Re: Callback function as soon as animation complete
            AG84 Level 1

            Hi Anne, thank you for your reply


            I generate children of a symbol dinamically, in very large numbers. The symbols playing could be brothers (children of the same symbol) and i want only one of their animation complete to trigger a callback function,

            additionally in the child symbols there are a lot of sequences of animation (I play them according to certain events), and it doesnt make good practice that i call a function at the end of each sequence.


            putting all my code at stage level gives me the most control and its the best practice, and sometimes necessary. i should be able to do that.


            Have a wonderful day and thanks again for the answer!



            • 3. Re: Callback function as soon as animation complete

              I'm looking for the same answer to this. If I understand that Edge does all of it's animation through jQuery, then it's absolutely supportable just using the promises API. The only question is how can we get to the underlying jquery animation from sym.play()? Here's a crude example of the animation promise: http://jsfiddle.net/wittnl/48WSR/1/