Your best bet is using the "is" operator and use something like:
for( var i:int = 0; i < componentArr.length; i++ )
{
var comp:UIComponent = componentArr[ i ];
if( comp is DataGrid )
// Handle DataGrid functionality here.
else if (comp is DropDown )
// Handle DropDown here
}
There is one problem with this approach, however. Because "is" will return true for all descendant classes, you must put all of the descendant classes before their ancestors -- List must come before ListBase. This can cause some annoyances.
// This is important to remember:
var mc:MovieClip = new MovieClip();
trace( mc is Sprite ); // true
There is one other option for cases where you want objects to be a member of a specific class (and not a descendant class): you can use the constructor property of the object and use a switch statement.
for( var i:int = 0; i < componentArr.length; i++ )
{
var klass:Class = componentArr[ i ].constructor;
switch( klass )
{
case DataGrid:
// Handle DataGrid
break;
case Text:
// Handle Text
break;
case NumericStepper:
// Handle NumericStepper
break;
default:
// Handle default
break;
}
}