try
public function $(object:String,container:DisplayObjectContainer = null) {
if (container == null) container = this;
for (var i:uint=0; i < container.numChildren; i++)
{
var child:DisplayObject = container.getChildAt(i);
if (child.name== object) {
return child;
}
if (container.getChildAt(i) is DisplayObjectContainer)
{
var obj:* = $(object,DisplayObjectContainer(child));
if (obj is DisplayObject) {
return obj;
}
}
}
}
use:
$('component');
--- In [email protected], "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
>
> This contains some text and I can access it fine.
>
> grid.getChildren()[1].getChildren()[0].getChildren()[0].text
>
>
> if I trace grid.getChildren()[1].getChildren()[0].getChildren()[0].id
>
> it says "component" which is the id of the text Container
>
> but if I try to access it like this
> component.text
>
> I get this message:
> Access of undefined property component
>
>
> Why can't I access text via the id ?
>