Lets say I have an ActionScript class: MyClass
and that class has data in it. Now, lets say I want to iterate over that data using "for each":
var myData:MyClass = new MyClass();
myData.Populate(fromSource);
for each(var item in myData) {
DoSomethingWith(item);
}
Of course, this does nothing, because MyClass
is a custom class, and I haven't done anything special to it yet.
What do I need to do to MyClass
to make it play nicely with "for each"? Can I hand it an iterator or an enumerator or something?