Hi,
Sometimes, we want to access all/some UIComponents of the application
or a particular view.
I have written a simple function using the recursion concept to get it
done.
Function will push all the UIComponents in arrChilds:Array, which can
be further filtered to get a particular components, like all Buttons /
HBOx / TextInput.. etc.
To invoke the function, you just need to give the object of the view
and its class name as parameter. eg.
getDocumentChildrens(this,this.className); will retrieve all the
components for the current view.
private var arrChilds:Array;
private function getDocumentChildrens
(obj:Object,className:String=""):void
{
if(obj.className == className)
arrChilds = new Array();
else
arrChilds.push(obj);
if(!obj.hasOwnProperty("getChildren"))
return;
var arr:Array = obj.getChildren();
for each(var obj1:Object in arr)
{
getDocumentChildrens(obj1);
}
}
Vaibhav.
Software Engineer.
HCL America Inc.
Quincy, MA, USA.
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.