Hey there. Here is a new series of quick, but hopefully useful tips for you.
We start of by executing some code after an animation has run once!
If you are coding on the timeline, then go ahead and do that, no need to be reading this post! (I would NOT recommend doing that – follow MJW’s avoider tutorial instead to get going)
If you’re not coding on the timeline, it’s actually really simple, just take a look at the code:
The reason i made animation.totalFrames – 1, is that addFrameScript is for some reason null based. This means it starts counting at 0, while the movieclip starts counting at 1. If you for an example want to add a frame script to frame 1, you need to call addFrameScirpt ( 0, nameOfFunction ) .
I basically made an example of it here (it would be no good if I just ran the code above, so I have added some event listeners and stuff). Click it to play the animation once. When the animation is finished, you can click it again to reset.