Is this possible?
Ive written a piece of code that checks what direction a movieclip is coming from, then plays the next clip in line from the relevant key frame, depending on what type the target movieclip is. I have the following code, but it doesnt seem to “break” when the condition is met, it carries on looping through :-/
switch (type) {
case "mc_1":
if (_root.direction == "right") {
playFrame = 2;
trace("right");
} else if (_root.direction == "left") {
trace("left");
playFrame = 21;
} else {
trace ("gameOver");
}
break ;
case "mc_2":
if(_root.direction == "top") {
playFrame = 2;
trace("top");
} else if(_root.direction == "bottom") {
playFrame = 21;
trace("bottom");
} else {
trace ("gameOver");
}
break;
default:
trace ("gameOver")
}
The switch statement is infact much bigger than this (there are 10 types of target movieclip, hence why nesting an if/else would seem to be the best route, rather than writing out more switch cases…