all groups > flash actionscript > august 2004 >
You're in the

flash actionscript

group:

Detecting MC Instance names


Detecting MC Instance names wadearnold
8/8/2004 7:02:57 PM
flash actionscript: I am trying to programatically detect all of the instance names that are part
of a movie clip. I assume that I would be able to get an array of instance
names and then iterate through the stack doing a "instanceof" comparison of all
of the objects. The question is how to I get all of the instance names of the
clip? I know that when you use getURL it passes the instance name and variable
value of all instances on the clip so that this must be possible somehow. The
goal of this is to dynamically set event handlers on UI components that are
brought onto the stage by developers.

Thanks for your help.
Wade Arnold
Re: Detecting MC Instance names kglad
8/8/2004 8:21:57 PM
if you want all object instances of movieclip mc, you can use:

for(obj in mc){
// mc[obj] is an instantiated object in mc
}

if you only want movieclip instances you can use a conditional using typeof().
Re: Detecting MC Instance names wadearnold
8/8/2004 9:27:54 PM
Thanks for your help! This is what I ended up doing in case others look at this
thread.



var myTextFields:Array = new Array();
for (obj in this) {
if (this[obj] instanceof mx.controls.ComboBox) {
myTextFields.push(this[obj]);
}
}
Re: Detecting MC Instance names kglad
8/8/2004 9:49:13 PM
AddThis Social Bookmark Button