# Help with AS3 card game

**URL:** <https://forum.kirupa.com/t/help-with-as3-card-game/326402>\
**Category:** flash\
**Created:** [December 12, 2011, 6:58am UTC](https://forum.kirupa.com/t/help-with-as3-card-game/326402 "2011-12-12T06:58:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palladian1881](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@Palladian1881](https://forum.kirupa.com/u/Palladian1881)\
**Post date:** [December 12, 2011, 6:58am UTC](https://forum.kirupa.com/t/help-with-as3-card-game/326402/1 "2011-12-12T06:58:33Z")

</div>

I’m trying to code a card game in AS3 for a class project. There are three computer players and one human player. The code to run the overall game is something like this:

```auto
function playGame(){
initialSetup();
for(var i:int = 0; i< 5; i++){ //there are five rounds
for each(var player in playersArray){
player.takeTurn();
}
}
}

```

The problem is that when it is the human player’s turn, they need to be able to press various buttons (bet, redraw, etc) before their turn ends. How can I make my game loop wait while the player does stuff? I tried creating a humansTurn boolean, setting it to true when it’s the human player’s turn, and having a while(humansTurn){} loop run until the boolean is turned off when the player clicks a button, but Flash freaked out and gave me a “timed out after 15 seconds” error. I also can’t see how splitting playGame() into two functions with a TimerEvent could work either. Please help!
