Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created June 10, 2011 17:54
Show Gist options
  • Save rafaelrinaldi/1019360 to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/1019360 to your computer and use it in GitHub Desktop.
Return an Array with the children of any container.
package tea.display
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
/**
*
* Return an <code>Array</code> with the children of any container.
*
* @param p_target The container you want.
*
* @author Rafael Rinaldi (rafaelrinaldi.com)
* @since May 25, 2011
*
*/
public function getChildren( p_target : DisplayObjectContainer ) : Array {
var children : Array = [];
for(var count : int = 0, child : DisplayObject; count < p_target.numChildren; count++) {
child = p_target.getChildAt(count);
if(child != null) children.push(child);
}
return children;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment