OK, I have an extended MovieClip class that has 10 Boolean properties. There are 6 instances of the clip on the stage. Any of the properties of each instance can be set independent of the same property in other instances, so…
clip1.foo = true;
clip2.foo = false;
//etc.
There are points in the timeline when I need a particular property in all of the instances to be the same. I set up a function…
function all(val):void{
for(var j:int=0;j<6;j++){
this["clip"+j].foo = val;
trace("clip"+j+" foo = "+this["clip"+j].foo);
}
}
all(true);
… which works, but only for the Boolean property [COLOR=red]foo[/COLOR]. I’d like to add different properties as an additional argument. I tried this…
function all(p,val):void{
for(var j:int=1;j<4;j++){
this["clip"+j].p = val;
trace("clip"+j+" foo = "+this["clip"+j].foo);
}
}
all(foo,true);
… which does NOT work. I’d like to be able to drop in any of the properties and a value into a single function, rather than having to concoct a function for each of the 10 properties. Is there a way to do this?
Many thanks in advance!