as far as I know there is no function in Flash that can do this fore you..
so I made this way (not the first one to think of this tho) to pause somthing!!
and I didnt find a tut in AS:Main about it.. so I made this one!!
pause how? cant I just use stop(); ?
you can.. but that would only stop the movieclips and so on from playing!!
with this code you can stop the code itself from hapening!!
what can I use this for?
a pause button?
like if you have a game where you control 1 MC with the araw keyes.. and a second MC folowes!!
now lets say you want to have a code telling the game to pause so that you cant controle the MC and the other MC wont folow!
CODE:
my way of doing this is I have a varaible named "pause" sett to false.. and when I need to pause I sett it to true!!
here is the code you add to the game/MCs
if(_root.pause == false){
//your code here
}
remember you still need the ClipEvent and so on tho!!
ok. so now you have sett up the game to play when _root.pause is false..
then we need to declare _root.pause
read more at AS: Variables
or just put
pause=false; in your main timeline!!
now we need a pause button.
make the button.. you should know how to if youv come this far..
and give it this code
on(release){
if(_root.pause==false){
_root.pause=true;
}else if(_root.pause==true){
_root.pause=false;
}
}
another way is to have a button on the keyboard to do this.. its poplular with "P"..
look that up at AS: KeyCode
same prinsip..
did I forget anything?
I hope not
-Phyconinja