_visible movie

I thought this was going to be basic, but I can’t seem to figure it out. I have 8 movie clips, each instance of them named t1, t2, t3, t4 …t8. I also have 8 buttons, each button sets the value of the variable “current” as an integer (I need var current to be an integer for another part of the movie). So this is what I have:

vid = "t"+current;
_root.vid._visible = true;

and it does not work.

Any suggestions?


try changing

_root.vid._visible = true


_root[vid]._visible = true

Assuming the rest of your code is okay, that should do it.

By hard-coding the variable into the path expression like that, you’re really telling Flash to look for a MC with the instance name “vid” somewhere on the _root level.

You’ve just got to add those wonderful braces around the variable (and drop the period before the braces) to let Flash know it’s a variable, not an instance name.

Worked perfect. Thank you.