PDA

View Full Version : controlling mc w/ mc - slightly different


k8barton
02-23-2002, 10:03 PM
hi,
i've read the other posts about controlling a mc from a button within another mc, and the tutorial, but i'm stuck on a variation of this problem.

i have a button within mc1, and want to tell mc2 to go to another frame when that button is pushed. this part works:

on(release) {
_root.mc2.nextFrame();
}

but i want to be able to tell mc2 to go back to frame 1 if the button is pushed again. mc2 just has two states, and i want it to switch back and forth... do i need a conditional statement - i.e. if you're in frame 1, go to frame 2, and if your'e in frame 2, go to frame 1? i tried it but it's not working and i'm pretty new at this, so...

thx for any ideas!

Billy T
02-24-2002, 07:14 AM
on(release) {
if (_root.mc2._currentframe==1){
_root.mc2.gotoAndStop(2);
} else{
_root.mc2.gotoAndStop(1);
}
}


cheers

k8barton
02-25-2002, 03:53 AM
thanks billy t --
i'll give it a try... that looks just like what i had tried writing, except w/o the double equals sign - is there a reason why one = doesn't work?
i feel pretty dumb for getting stuck on this; actually i found a work-around yesterday by doing
_root.mc2.gotoAndStop(2); and
gotoAndStop(2);

and then in frame 2 of mc1 i have another button which does the opposite. works too, but i like the simplicity of a conditional statement rather than having two frames to do everything.

Billy T
02-25-2002, 06:08 AM
= sets a value

== checks a value

cheers