Hi,
I have a long movie with a lot of MCs and sound, and want to have 2 buttons PLAY and PAUSE. The PAUSE button would stop the whole movie and when the PLAY button is pressed, the movie begins from there it stopped last time, just like a play/pause on a VCR. I have tried with _root.stop(); but it seems thar it doesn’t work.
My buttons are inside another MC.
Just another thing. I think the _root.stop(); works but not at the exact position. For instance I have a scale function running to scale up MC1 (onEnterFrame method) and after that, some other actions. I can see that when pressing the PAUSE button, the scaling continues on the screen but the next action paused. Is there any method to stop the whole movie exactly where the movie is (in the middle of scaling for example) ?
use trace(); statment to debugg
and check in the output window, is it the button works.
good luck!
to cycle through every movieclip on the currentframe, you can use
for (i in _root) {
currentMC = _root*;
//now you can use currentMC to refer to the movieclip that is currently selected
}
if you would like to stop every movieclip on the current frame, you could use:
for (i in _root) {
currentMC = _root*;
currentMC.stop();
}
this will allow you to control, and hence stop or play, all movieclip in _root
if you mean that some of the animation is done my as, then you should include a logical test in the onEnterFrame() { ; } to see whether or not it is ok to continue to perform it’s actions.
hope this helps you out. if not, try posting the fla (-:
You mean that every MC has to be stopped by that for loop?
Isn’t there any stop() function which works globaly over the whole movie?
mx-guest2004
not all in one command. you could make a function called allStop() or something like that, but it would have to include similar code to what i posted.
to answer your question, yes you will need to stop each movieclip individually
This works for several levels and if you want to go deeper just add more loops
function DoAll(container, func) {
containerfunc;
for (var obj in container) {
if (typeof (container[obj]) == “movieclip”) {
container[obj]func;
for (var mob in container[obj]) {
if (typeof (container[obj][mob]) == “movieclip”) {
container[obj][mob]func;
}
for (var dab in container[obj][mob]) {
if (typeof (container[obj][mob][dab]) == “movieclip”) {
container[obj][mob][dab]func;
}
}
}
}
}
}
DoAll(_root, “stop”);
if you have used actionscript to move stuff etc you could just delete the onEnterFrames in each level
eg/for the first loop
function DoAll(container, func) {
containerfunc;
for (var obj in container) {
if (typeof (container[obj]) == “movieclip”) {
delete container[obj].onEnterFrame
very similar to what cyberA told you just goes deeper and is specific to mcs
Thank you very much cyberathlete and stringy
I’ll try the method and the code as soon as I get to the office
mx-guest2004