^I don't think that was valid syntax. AS is too verbose so I make stuff up.
Still not clear what you're doing and what you have, so I'll assume I'm making a real-time game where objects act on their own (like you described), and I'd like to pause the game and graphics, but have some kind of UI animation while they're paused.
First of all I don't use an ENTER_FRAME listener for each object. I store active objects in a list and iterate them from a single enterframe listener. So pausing is as easy as skipping that iteration.
Secondly I'd put the game graphics in a designated sprite object, so when I want to pause all sprites, I only apply the recursive pause function to that sprite.
So the code would look like this:
function mainUpdate (_)
{
if (Game.paused) return;
for (x in activeobjs) x.update ();
}
function applyToAll (f, target : Sprite)
{
for (d in 0 ... target.numChildren-1)
{
var child = target.getChildAt (d)
f (child);
if (child is Sprite) applyToAll (f, child);
}
}
function pause ()
{
Game.paused = true;
applyToAll (gameviewcont, function (x) x.stop ());
}
function unpause ()
{
Game.paused = false;
applyToAll (gameviewcont, function (x) x.play ());
}
...Or somethiiiing. Seriously do it however.