0
\$\begingroup\$

I'm trying to code a game of Poker in AS3, using Flash Professional CS5 (although I try to keep as little code as possible in the .fla).

When a player bets, for example, I need to be able to show an animation of some chips sliding into the center of the screen. After that happens, the AI decides what to do, and another animation of their chips occurs. Then a menu pops up so the player can choose their own next action. And so on.

I started writing a UIBet interface with bet(amount) and raise(amount) methods and so on, that you would implement with a class extending MovieClip and fill in the methods with gotoAndPlays to various animations. But if I just have code that calls these graphics object like so:

playerUIBet.bet()
aiUIBet.bet()
menu.prompt()

Then, if I understand Flash correctly, what'll happen is that the code will finish executing, and then all of those animations will happen simultaneously.

How can I get these animations to happen sequentially? What if I want to insert pauses between them? Some kind of solution like this? What's the best way to do this in AS3?

\$\endgroup\$
1
\$\begingroup\$

There are multiple ways to address this problem, but my recommendation would be to use a tweening library like TweenLite. For simpler animations you can simply write the animations in code, and for other situations you can set delayed calls to functions using TweenLite.delayedCall()

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.