Payday Loans Online Payday Loans Online

Todd Rothe : UI/UX Developer

it's pronounced rowth-ee

By 2g1c2 girls 1 cup

When getChildren() Is Not Available What Can I Use Instead? childDescriptors . . .

getChildren() is a method of Container which returns an Array of child DisplayObjects – children of a Container. What if there is no getChildren? How can you reference children or siblings?

While working with FlexMDI I ran into a case where getChildren() was not available on a container that extended Canvas. Strange but true.
As an alternative I used childDescriptors() to build an array of sibling names, similar to what getChildren would have returned.
The following sample code uses childDescriptors and would be placed in a child of a container to return a list of siblings.

private var siblingIDs:Array = new Array();

public function onCreationComplete():void
{
var siblingDescriptors:Array = (this.parent as Canvas).childDescriptors;

for (var i:Number = 0; i<siblingDescriptors.length; i++)
{
siblingIDs.push(siblingDescriptors[i].id);
}
trace(“siblingIDs : “+siblingIDs);
}

 

No Responses to “When getChildren() Is Not Available What Can I Use Instead? childDescriptors . . .” (post new)

 

Leave a Reply

You must be logged in to post a comment.