Hi,
1)

There is a method of DisplayObjectContainer that does this by name.

getChildByName();

Note : This does not return a child by it's id only the name assignment. Which at anytime you can name a component in MXML or actionscript.

myComponent.name = "lblText";

Then you could find it. If you need recursion to walk a component's child list that is not very hard to write either.

2)

If you are talking non recursive;

var len:int = myComponent.numChildren;
for (var i:int = 0; i < len; i++)
{
   child:IUIComponent = IUIComponent(myComponent.getChildAt(i));
   child.move(x, y);
}

The same can be applied if you have a custom component class that you are iterating through and you could 'is' to test to make sure it would have the method you are about to call.

There is also a Container.getChildren() method that will return all children of the container as IChildList. Basically you use the IChildList interface to get at children of a Container. See the ASDocs for that.

Peace, Mike


On 8/17/06, richmcgillicuddy <[EMAIL PROTECTED]> wrote:

How would I do the following in AS3.

1. Find an object by id, something like:

psuedo code-

foundobject = app.components.findbyID("lblText");
foundobject.dostuff;

2. Similar, is there a app.components that I can cycle through that
will list all application components/objects.

psuedo code again

for (i=0;i<components.count-1; i++) {
var thisObject:TObject = components[i];
thisObject.doStuff..
}

Rich




--
What goes up, does come down. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to