PDA

View Full Version : Hide movie clips



m-blo
December 1st, 2004, 09:30 AM
Is it possible to hide several movie clips at once by adding their instance names to an array, and then creating some kind of function? If it is, could anyone please give me an example of such a function?

Adam
December 1st, 2004, 12:47 PM
var MCs = [_root.mc1, _root.mc2, ..., _root.anotherMC];
MCsVisible = function (value) {
for (var prop in MCs) {
if (MCs[prop] instanceof MovieClip) {
MCs[prop]._visible = false;
}
}
}

// make MCs visible
MCsVisible(true);
// make MCs invisible
MCsVisible(false);


might work, I'm at work, so I haven't tested it, but the code was taken from snippets of Kode's and lunatic's code, so I'm sure they work fantastic.

Adam