Help help help variables

hi guys i need help ;-)\r\ri’v 3 button on a line, if u click button1 it goes below the line, if u click button2 it should go below the line and button1 should go back to its previous position. this should work for the 3 buttons.\r\rSo i set a variable on the first frame of my movie\r\rvar discesa;\rset(discesa, “null”);\r\rthen i wrote this code on every button so in the button timeline i go to the label that restores the position of other buttons, and in the main timeline i go where i need to.\r\ron (release) {\r\r// the button goes down in its timeline\r\r gotoAndPlay(“down”);\r\r//and i change frame in the main timeline\r\r _root.gotoAndPlay(“b3”);\r\r// then the other 2 buttons go up in their own timelines if the variable is set with their values\r\r \r if (discesa, “b1”) {\r _root.b1.gotoAndPlay(“up”);\r } else if (discesa, “b2”) {\r _root.b2.gotoAndPlay(“up”);\r }\r}\r\r// last but not least i set the variable with the currnt button name\r\r set(discesa, “b3”);\r\r\r\ri don’t know if i’ve been enough understandable…\r\rthanx

That is really a pain in the neck. I never know how to do that, so I use the same technique as you do : I store the name, initialize 2,000 markers and then ask it to play out. Actually, I asked RenniGirl how to do that a while ago, but never made myself understood by her, so I don’t know. Ask her :smiley: \r\rpom 0]

One thing you want to be careful of is this:\r--------------------\rvar discesa;\rset(discesa, “null”);\r--------------------\rall you really have to do is this:\rdiscesa="";\r\rWhen you use “var” it makes the variable avaliable only to the script that the variable is located inside of… not the rest of the movie.\r\rThe other thing is, if you have an if statement, where you are judging equality, then you need to word it like this.\r\rif (discesa==“b1”){}\r\rFlash uses “==” to ask, “is this equal to this”.

ok so it should be like this:\r\r//here is the firstframe script\r\rdiscesa = “null”;\r\r// here are the scrpts for the 3 buttons\r\r//but buell\r\ron (release) {\r gotoAndPlay(“down”);\r _root.gotoAndPlay(“buell”);\r if (discesa==“harley”) {\r _root.buttonharley.gotoAndPlay(“up”);\r } else if (discesa==“malaguti”) {\r _root.buttonmalaguti.gotoAndPlay(“up”);\r }\r}\r// framelabel down\r\rdiscesa = “buell”;\r\r//but harley\r\ron (release) {\r gotoAndPlay(“down”);\r _root.gotoAndPlay(“harley”);\r if (discesa==“buell”) {\r _root.buttonbuell.gotoAndPlay(“up”);\r } else if (discesa==“malaguti”) {\r _root.buttonmalaguti.gotoAndPlay(“up”);\r }\r}\r\r// framelabel down\r\rdiscesa = “harley”;\r\r// but malaguti\r\ron (release) {\r gotoAndPlay(“down”);\r _root.gotoAndPlay(“malaguti”);\r if (discesa==“harley”) {\r _root.buttonharley.gotoAndPlay(“up”);\r } else if (discesa==“buell”) {\r _root.buttonbuell.gotoAndPlay(“up”);\r }\r}\r\r// framelabel down\r\rdiscesa = “malaguti”;\r\rit should work but it does not.\r\r

2 things : I don’t think you can actually tell a button to go to its down state (gotoAndPlay(“down”) in a button ???). Or maybe that’s not what you’re doing, and you’re simply manipulating a movie clip.\r\rIn that case, you shouldn’t put “discesa” but _root.discesa so that you can access it from everywhere.\r\rpom 0]

yes u r right, they are 3 movieclips.\r\ranyway they don’t work :frowning:

Send the file to me. I’ll see what I can do with it.\r\r[email protected]