public class GetChildren
The GetChildren class allows to trace the children of an object and their subchildren. It can be distinguished between objects directly placed or those used using addChild. For those names should be given, which are numbers. To create a background use the constructor new GetChildren() and add parameters as desired. The first parameter is the object to determine the number of children and the second is the one to dispatch the event to. Three arrays can be traced: stageArray, for children of the stage, addChildArray, for children added using addChild() and regChildArray for children placed directly. Two parameters can be retrieved: Array[].label and Array[].data. The label parameter is a string, whyle the data parameter gives the actual object.
Public Properties \
Property Defined By
StageArray : Array
An array containing all objects from the stage.
AddChildArray : Array
An array for objects created using addChild.
RegChildArray : Array
An array for objects directly placed on stage.
Public Methods
Method Defined By
GetChildren(target:Object, targetDispatch:Object) GetChildren
Event Defined By


This event is dispatched when search for objects is completed.

Property Detail
StageArray property
StageArray:Array [read-write]

Sets and returns an array containing all objects from the stage.

There is no default value.


public function get StageArray():Array
public function set StageArray(value:Array):void
AddChildArray property
AddChildArray:Array [read-write]

Sets and returns an array for objects created using addChild.

There is no default value.


public function get AddChildArray():Array
public function set AddChildArray(value:Array):void
RegChildArray property
RegChildArray:Array [read-write]

Sets and returns an array for objects directly placed on stage.

There is no default value.


public function get RegChildArray():Array
public function set RegChildArray(value:Array):void
Constructor Detail
GetChildren ()  Constructor
public function GetChildren(target:Object, targetDispatch:Object)
Intializes a new GetChildren instance with the specified parameters.


  • target:Object ____ The object to search children from.
  • targetDispatch:Object ____ The object to dispatch the event to.
Event Detail

displayChildren event

Event Object Type: biz.flashscript.utils.GetChildren
Event.type property = biz.flashscript.components.utils.GetChildren.DISPLAY_CHILDREN

Dispatched when the search is finished.

Create a new fla file and name it GetChildren.fla. Place the fla in the same folder as the biz folder. Add a MovieClip containing two shapes and name it "mc" and add a static TextField. Add a dynamic textfield and name it myText. Then create an Actionscript file, name it and place this script. You should see a trace similar to the one shown below in the textfield. The error message is legal, since it is caused by a catch function.
	import flash.display.Sprite;
	import flash.text.TextField;
	import biz.flashscript.utils.GetChildren;

	public class Getchildren extends Sprite
		private var gc:GetChildren;
		public var myText:TextField;
		public function Getchildren ():void
			var aa:Clip = new Clip(); = "1";
			addChild (aa);
			var bb:Clip = new Clip();
			bb.x = 200; = "2";
			addChild (bb);
			var cc:TextField=new TextField();
			addChild (cc); = "3";
			gc = new GetChildren(this,this);
			addEventListener (GetChildren.DISPLAY_CHILDREN, listChildren);
		private function listChildren (e:Event):void
			for (var a=0; a < gc.StageArray.length; a++)
				myText.appendText ("stageChildName: "+gc.StageArray[a]"\n");
				myText.appendText ("stageChild: "+gc.StageArray[a].label+"\n");
			for (var i=0; i < gc.AddChildArray.length; i++)
				myText.appendText ("addChildValue: "+gc.AddChildArray[i].data.valueOf()+"\n");
				myText.appendText ("addChildName: "+gc.AddChildArray[i]"\n");
				myText.appendText ("addChild: "+gc.AddChildArray[i].label+"\n");
			for (var j=0; j < gc.RegChildArray.length; j++)
				myText.appendText ("regChildValue: "+gc.RegChildArray[j].data.valueOf()+"\n");
				myText.appendText ("regChildName: "+gc.RegChildArray[j]"\n");
				myText.appendText ("regChild: "+gc.RegChildArray[j].label);