Hi y'all.
I started making a menu for my game today, and it is going well,and added with virtually problems, except one. When i activate my pause function, it cancels all my _root. onEnterFrames, it just stops them somehow. I used trace(); to bring up "EnterFrame" in the output panel, but as soon as i run the function, it stops.
Basically, the function (when called), makes a mC dynamically tween onto the stage, then when 'back to game' is pressed in teh menu, it retracts. That all works fine.
Anyway, here's the pause code, if anyone can tell why it's stopping my enter frame, please tell me. I also have code on a button so that when 'Insert' is pressed, it pauses.
function pauseMenu() {
if (!pauseComplete && mC._x<=-100) {
for (i=0; i<20; i++) {
_root["Enemy3"+i].stop();
}
mC.swapDepths(getNextHighestDepth());
Cursor1.swapDepths(getNextHighestDepth());
Cursor2.swapDepths(getNextHighestDepth());
Cursor3.swapDepths(getNextHighestDepth());
_root.gamePaused = true;
clearInterval(_root.en3Int);
clearInterval(_root.en1Int);
pauseComplete = true;
trace("!gamePaused");
gamePaused = true;
var pauseMove:Tween = new Tween(mC, "_x", Elastic.easeOut, -263.4, 300, 2, true);
onEnterFrame = function () {
pauseDistance = 300-mC._x;
if (pauseDistance<0) {
pauseDistance *= -1;
}
var pauseBlur:BlurFilter = new BlurFilter(pauseDistance/6, 0, 1);
mC.filters = [pauseBlur];
};
}
if (pauseComplete && mC._x == 300) {
pauseComplete = false;
trace("gamePaused");
var pauseMove:Tween = new Tween(mC, "_x", Elastic.easeIn, 300, -263.4, 2, true);
onEnterFrame = function () {
pauseDistance = 300-mC._x;
if (pauseDistance<0) {
pauseDistance *= -1;
}
var pauseBlur:BlurFilter = new BlurFilter(pauseDistance/6, 0, 1);
mC.filters = [pauseBlur];
};
pauseMove.onMotionFinished = function() {
for (i=0; i<20; i++) {
_root["Enemy3"+i].play();
}
_root.gamePaused = false;
en1Int = setInterval(createEnemy1, (20-level)*300);
en3Int = setInterval(createEnemy3, (20-level)*400);
};
}
}
