PDA

View Full Version : Variable problem...


zebbah
12-12-2002, 10:56 PM
hello!

I don't understand how to do this....

i have a button which goes to a "off" frame when released. on the same release event i'm trying to hold the name of the button instance (a mc) in a variable with _name. _root.variableName = _name

this works fine, but the problem is that i want it to go to a "on" frame when another button is pressed.

i thought _root.variableName.gotoAndStop("on") in the onrelease of the other button would work, but it doesn't...

anybody know what i'm doing wrong?
thanx for any help!

:)

simontheak
12-13-2002, 09:08 AM
Originally posted by zebbah
[B _name. _root.variableName = _name [/B]

I know you said that it worked ok, but this bit really doesn't look right. Nothing should come before _root, otherwise it's just kind of useless. What are you trying to do? Store the name of a movie clip instance? Try this:
myButton = _root.MovieClipInstance.ButtonInstance._name

zebbah
12-13-2002, 01:32 PM
ooops... sorry. the _name part was just the end of the sentence in my previous post. should've written it in separate lines...

what i'm trying to do is to store the instance name of buttons when they are pressed, so when another button is pressed it can tell the last button pressed to go to the "on" frame.

hmm... does it make any sense?

if i use: myButton = _root.MovieClipInstance.ButtonInstance._nameto store the name, can i just use this in another button?:_root.myButton.gotoAndPlay("on"); thanks for your help, simontheak. i will try this. :)

simontheak
12-13-2002, 04:10 PM
Originally posted by zebbah
if i use: [as]_root.myButton.gotoAndPlay("on");
[as]

I think you'd probably have to put something like:

_root[myButton].gotoAndPlay("on");