I want to list all controls (buttons, datagrids, etc) in a container
This works but gives me a warning 1008: variable 'comp' has no type declaration.
for (var i:int = 0;i<this.numElements;i++)
{
var comp = this.getElementAt(i);
trace(comp.id);
}
This is how I thought it should work but gives me a compiler error 1119: Access of possibly undefined property id through a reference with static type mx.core:IVisualElement.
for (var i:int = 0;i<this.numElements;i++)
{
var comp:IVisualElement = this.getElementAt(i);
trace(comp.id);
}
In my head, when I get a compiler warning it’s because I’m not doing something the way it is supposed to be.
Are there any alternatives to reference the id property? A method I’m missing even a whole different way iterate through all the controls?
Type it as a
UIComponent. Components will extend this class. (fl.controls components and mx.core components both extend a UIComponent class)