You're looking for "infinite recursion". Generally speaking, your application might be better served with a for() loop to iterate through the command queue within a single function call. There are times when recursive functions (i.e., functions that call themselves) are more elegant, though.
-Chris -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mark Hawley Sent: Tuesday, December 13, 2005 9:40 AM To: [email protected] Subject: [Flashcoders] The Amazing infinite call stack I'm sure this has a ridiculously easy answer that I just never learned from my generally informal programming training, but I can;t figure out what the problem is called, so I can't just google an answer. Here's the (simplified) situation: 1. (Game::main()) we call Game::main(); no surprises here. 2. (_engine = new Engine()) Main sets up an 'engine' class and gets it started up. 3. (_engine.getNextCommand()) Engine's job is basically to look at a queue of Commands, ordered by the time they're supposed to execute, get the next one, and execute it. 4. (_engine.onTurnComplete()) Engine waits until it gets notified that the current turn is finished. 5. (engine.getNextCommand()) Engine looks for the next command....etc. Now, the problem is that _engine.getNextCommand() never returns, so I end up with a huge call stack with getNextCommand()s piled high, which eventually makes Flash crap out. In the ancient version of this game, the three basic stats were on different frames, so that the implied loop here was broken up, and worked fine. My brain can't see that "right" way to do this via main(), though. Any help, insight, or google search terms? -Mark Hawley _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

