So - I have a bunch of instances of a class and there's a function I want to call on all of them. I'm wondering if rather than loop through every instance that I have, is there some way I can declare a function on the class that when called runs on each instance? For example - if my class looks like this:
public class MyClass{
public var variable:String = "";
public function MyClass(){}
public function myFunction():void{
this.variable = "BLORE";
}
}
and I have a bunch of these:
var class1:MyClass = new MyClass();
var class2:MyClass = new MyClass();
is there a way I can call MyClass.myFunction()
and have it called on all of my instances?
I don't know if I'm explaining this well...but there it is. I'd love any suggestions you have that don't just involve "put your instances in an array or vector and loop through them like a real man."