PDA

View Full Version : object names in for loop...



davetamzin
January 6th, 2003, 10:25 AM
I have 8 text boxes (called h1, h2 etc) that I want to do things with, the code below is just to make them all invisible when the movie loads,

this works:


for (b=1; b<9; b++) {
_root["h"+b]._visible = false;
}


The problem is I don't want a _root reference as I want to load this swf into another, but if I remove the _root and the brackets the code doesn't work...

any hints please?

senocular
January 6th, 2003, 10:33 AM
use this instead of _root if this code is being called in the timeline in which h1-h9 exist

for (b=1; b<9; b++) {
this["h"+b]._visible = false;
}