PlayAnim Sync

Find quick help here to get you started with Hollywood
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

PlayAnim Sync

Post by djrikki »

Please can someone give me an example of how to open an animation in a display, but crutially allow the user to stop the animation if they press the ESC key.

I've been playing with the Async attribute of the PlayAnim function, but with little success. Naturally I tried IsAnimPlaying() first, but accordingly to the documentation that command has been made obselete some time - it would have been ideal to use that along with IsKeyDown.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5834
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: PlayAnim Sync

Post by airsoftsoftwair »

PlayAnim() was designed to play anims synchronously, i.e. without returning control to your script. There are two ways to have an anim playing without getting your script blocked:

1) Set the "Async" tag to TRUE and then call AsyncDrawFrame() to skip to the next frame.

2) Enable layers and use NextFrame() to display the next frame. In that case, you must not use PlayAnim() but DisplayAnimFrame() so that a layer of type #ANIM is added.

Both solutions boil down to the same point, though: In both cases you'll have to manually call a function that will display the next anim frame. It's not really convenient but that's the way the anim API was designed :)
Post Reply