This should give you an idea...
var searchcanvasChildren:Array = searchcanvas.getChildren();
for(var i:int = 0 ; i < searchcanvasChildren.length ; i++)
{
if( searchcanvasChildren[i] is TextInput)
{
Alert.show(( searchcanvasChildren[i] as TextInput).id + ":" + (
searchcanvasChildren[i] as TextInput).text);
}
}
--- In [email protected], "trefalgar" <trefal...@...> wrote:
>
> I'm striking out finding an answer elsewhere, so here goes ;)
>
> I am taking an array of objects and using it to dynamically create a
list of text and textinputs:
>
> searchcanvas.removeAllChildren();
> var fields:Array = ArrayUtil.toArray(event.result.fields);
> if ( fields.length > 1 ) {
> for each (var item:Object in fields) {
> var ctext:Text = new Text;
> ctext.text = item.Field + ":";
> var ctextinput:TextInput = new TextInput;
> ctextinput.id = item.Field;
> searchcanvas.addChild(ctext);
> searchcanvas.addChild(ctextinput);
> }
> }
>
> It works just fine. On the panel I get a list of {text}:, followed by
the actual textinput field. The only problem is I can't figure out how
to reference those textinputs now that they're created! I've searched
through a debug session and can't find the children anywhere, I've also
tried using getChildNameByText, and it always returns null.
>
> Any tips?
>
> Thank you,
>
> Tref
>