Wait problem after animation
Hi,
I got now a similar problem like hundreds of other users (searching the forum with keyword „wait“). Most of them were satisfied with the solution to use the setinterval.
But I didn’t find any suitable solution for my problem.
Is there anybody who could help me?
My Flash Project (AS 2.0) should represent a cardgame.
I divided this in the following sections.
In the maintimeline a menu is handled like „new game“, „Rules“ and so on.
The first class represents the game leader „gameleader“. This class is responsible to know how the game should going on depending on different events, cards and inputs of the PC-User, which plays against the computer.
The second class „gametable“ represents the table where the game is played.
It contains the cards, shuffling the cards and so on.
The third class represents the gambler.
It accepts the cards, save it, plays a card depending on the rules of the game, and it should show the cards on the stage (either the back or the frontside).
My project is now at a point where 3 each cards are given to 4 gamblers (first round).
Therefore some functions and methods have been called (Menu-> new, shuffle, and so on).
At this point I wanted the cards to be animated and I made a Transition and/or a Tweening for each card.
The effect is that the animation starts first when the mainmethods/functions are leaved and then all cards are animated together.
Of course the onMotionFinished/allTransitionsInDone functions (asynchronous) are also actived when all cards were animated.
I want that one card appear, animates and then show the next card.
Someone could say I should only play/animate 1 card, wait for finishing and then show the next card.
But I see no possibility to do so, because when the onMotionFinished/allTransitionsInDone function is activated I left my previous path and I lost my context.
I would like to have a synchronous activation of a waitstate like a pend / unpend function.
Do you see any solution therefore?
Here again a short summary:
Main line Class gameleader Class gametable Class gambler
event new -> init Table/gambler
dispatching tasks
depend. on rules
for example -> shuffle cards
-> give cards to gamblers -> save cards
sort etc.
show card with
animation
[ *** pend***] --> not supported
[continue <-- unpend]
--> do anything
leaving <--
asynchronous onMotionFinished function (eventObject:Object)
context from where the animation was started is lost!!!
eventObject has only type and target