Controlling a movie clip with buttons and variables

I have been having a problem getting something to work for me. Hopefully one of you can help me! \r\rThis might be hard to explain and understand.\r\rI have two buttons (a and b) and a ball movie clip (ballMove) on the screen.\r\rThis is what I want to happen:\rThe ball starts off under button A. If you click button A, the ball stays where it is. If you click button B, the ball moves over to button B.\r\rWhen the ball is under button B it won’t move if B if clicked, but will move to A if A is clicked.\r\rHow I plan on doing this is within the ball movie there will be three motion tweens, staggered so they don’t overlap. \r\rThe first isn’t a tween at all, actually. It is one key frame at the very start of the movie timeline. I have labelled it “beginning”. Also, it has a stop action and \rvar bus\rbus = 1. \rBus is the variable I want to use to track the position of the ball.\r\rThe next tween is the ball travelling from point a to b. The start frame is labelled “atobbegin”. There is a keyframe at the end labelled “atobeend”. A stop action is on this keyframe, and also bus = 4.\r\rThe final tween is the ball travelling from point b to point a. The start frame is labelled “btoabegin” and the end keyframe is labelled “btoaend” with a stop action and bus = 8.\r\rEek, just got Deja Vu.\r\rer, moving right along…\r\rOn button A I have assigned these actions:\ron (release) {\rif (_root.ballMove.bus == 4) {\r_root.BallMove.gotoAndPlay(“btoabegin”);\r}else if (_root.ballMovebus == 1) {\r_root.ballMove.gotoandPlay(“btoaend”);\r}else if (_root.ballMovebus == :cool: {\r_root.ballMove.gotoandPlay(“btoaend”);\r}\r}\r\rButton B has this:\r\ron (release) {\rif (_root.ballMove.bus == 4) {\r_root.BallMove.gotoAndPlay(“atobend”);\r} else if (_root.ballMove.bus == 1) {\r_root.ballMove.gotoandPlay(“atobbegin”);\r} else if (_root.ballMove.bus == 8 ) {\r_root.ballMove.gotoandPlay(“atobend”);\r}\r}\r\rWhen I play the movie it seems to work OK, but then I notice that the ball rolls when it isn’t supposed to, and eventually it stops working altogether.\r\rHelp! \r\rI hope I have explained this sufficiently.\r\rI’m sure it’s a tiny dumb mistake that I am overlooking.\r

Um. I don’t know where that smiley face came from.\r\rAnyway, I got it to work! Allit needed was a gotoandStop instead of a gotoandPlay on button b var 4

yeah those smileys can be anoying. If you’re posting code, your best bet is to click off the little check box at the bottem of your reply screen that says “Emoticons”. Those are the little smiley face icons and are usually produced by a combination of parenthese, colons and or other symbols. :slight_smile: