The ChildAccess abstract simplifies access to nested DisplayObjects. Although performance may be somewhat slower than using direct references, this is especially useful when setting up a UI or performing non-intensive tasks.

For example, consider the following hierarchy:

movieClip -> sprite -> sprite2 -> textField

You can use ChildAccess to more easily reference TextField:

var movieClip:ChildAccess<MovieClip> = movieClip;
movieClip.sprite.sprite2.textField.text = "Hello World";

Without ChildAccess, it can be more difficult to access nested objects:

var sprite:Sprite = cast movieClip.getChildByName("sprite");
var sprite2:Sprite = cast sprite.getChildByName("sprite2");
var textField:TextField = cast sprite2.getChildByName("textField");
textField.text = "Hello World";

ChildAccess provides most of the benefits of dynamic references, while still remaining strongly typed for properties.

You can use array access to reach child instances as well. This is useful if the child object has the name of a DisplayObject property, or if it uses special characters:

var movieClip:ChildAccess<MovieClip> = movieClip;
movieClip.sprite["sprite2"].x = 100;

Static variables

staticalpha:Float

Accesses the alpha property.

staticantiAliasType:AntiAliasType

Accesses the antiAliasType property (for TextField instances only).

staticautoSize:TextFieldAutoSize

Accesses the autoSize property (for TextField instances only).

staticbackground:Bool

Accesses the background property (for TextField instances only).

staticbackgroundColor:Int

Accesses the backgroundColor property (for TextField instances only).

staticbitmapData:BitmapData

Accesses the bitmapData property (for Bitmap instances only).

staticblendMode:BlendMode

Accesses the blendMode property.

staticborder:Bool

Accesses the border property (for TextField instances only).

staticborderColor:Int

Accesses the borderColor property (for TextField instances only).

staticread onlybottomScrollV:Int

Accesses the bottomScrollV property (for TextField instances only).

staticbuttonMode:Bool

Accesses the buttonMode property (for Sprite instances only).

staticcacheAsBitmap:Bool

Accesses the cacheAsBitmap property.

staticcacheAsBitmapMatrix:Matrix

Accesses the cacheAsBitmapMatrix property.

staticread onlycaretIndex:Int

Accesses the caretIndex property (for TextField instances only).

staticcondenseWhite:Bool

Accesses the condenseWhite property (for TextField instances only).

staticread onlycurrentFrame:Int

Accesses the currentFrame property (for MovieClip instances only).

staticread onlycurrentFrameLabel:String

Accesses the currentFrameLabel property (for MovieClip instances only).

staticread onlycurrentLabel:String

Accesses the currentLabel property (for MovieClip instances only).

staticread onlycurrentLabels:Array<FrameLabel>

Accesses the currentLabels property (for MovieClip instances only).

staticread onlycurrentScene:Scene

Accesses the currentScene property (for MovieClip instances only).

staticdeblocking:Int

Accesses the deblocking property (for Video instances only).

staticdefaultTextFormat:TextFormat

Accesses the defaultTextFormat property (for TextField instances only).

staticdisplayAsPassword:Bool

Accesses the displayAsPassword property (for TextField instances only).

staticdoubleClickEnabled:Bool

Accesses the doubleClickEnabled property (for InteractiveObject instances only).

staticread onlydropTarget:DisplayObject

Accesses the dropTarget property (for Sprite instances only).

staticembedFonts:Bool

Accesses the embedFonts property (for TextField instances only).

staticenabled:Bool

Accesses the enabled property (for MovieClip instances only).

staticfilters:Array<BitmapFilter>

Accesses the filters property.

staticfocusRect:Null<Bool>

Accesses the focusRect property (for InteractiveObject instances only).

staticread onlyframesLoaded:Int

Accesses the framesLoaded property (for MovieClip instances only).

staticread onlygraphics:Graphics

Accesses the graphics property (for Shape or Sprite instances only).

staticgridFitType:GridFitType

Accesses the gridFitType property (for TextField instances only).

staticheight:Float

Accesses the height property.

statichitArea:Sprite

Accesses the hitArea property (for Sprite instances only).

statichtmlText:UTF8String

Accesses the htmlText property (for TextField instances only).

staticread onlyisPlaying:Bool

Accesses the isPlaying property (for MovieClip instances only).

staticread onlylength:Int

Accesses the length property (for TextField instances only).

staticread onlyloaderInfo:LoaderInfo

Accesses the loaderInfo property.

staticmask:DisplayObject

Accesses the mask property.

staticmaxChars:Int

Accesses the maxChars property (for TextField instances only).

staticread onlymaxScrollH:Int

Accesses the maxScrollH property (for TextField instances only).

staticread onlymaxScrollV:Int

Accesses the maxScrollV property (for TextField instances only).

staticmouseChildren:Bool

Accesses the mouseChildren property (for DisplayObjectContainer instances only).

staticmouseEnabled:Bool

Accesses the mouseEnabled property (for InteractiveObject instances only).

staticmouseWheelEnabled:Bool

Accesses the mouseWheelEnabled property (for TextField instances only).

staticread onlymouseX:Float

Accesses the mouseX property.

staticread onlymouseY:Float

Accesses the mouseY property.

staticmultiline:Bool

Accesses the multiline property (for TextField instances only).

staticname:String

Accesses the name property.

staticneedsSoftKeyboard:Bool

Accesses the needsSoftKeyboard property (for InteractiveObject instances only).

staticread onlynumChildren:Int

Accesses the numChildren property (for DisplayObjectContainer instances only).

staticread onlynumLines:Int

Accesses the numLines property (for TextField instances only).

staticread onlynumTiles:Int

Accesses the numTiles property (for Tilemap instances only).

staticopaqueBackground:Null<Int>

Accesses the opaqueBackground property.

staticpixelSnapping:PixelSnapping

Accesses the pixelSnapping property (for Bitmap instances only).

staticrestrict:UTF8String

Accesses the restrict property (for TextField instances only).

staticread onlyroot:DisplayObject

Accesses the root property.

staticrotation:Float

Accesses the rotation property.

staticscale9Grid:Rectangle

Accesses the scale9Grid property.

staticscaleX:Float

Accesses the scaleX property.

staticscaleY:Float

Accesses the scaleY property.

staticread onlyscenes:Array<Scene>

Accesses the scenes property (for MovieClip instances only).

staticscrollH:Int

Accesses the scrollH property (for TextField instances only).

staticscrollRect:Rectangle

Accesses the scrollRect property.

staticscrollV:Int

Accesses the scrollV property (for TextField instances only).

staticselectable:Bool

Accesses the selectable property (for TextField instances only).

staticread onlyselectionBeginIndex:Int

Accesses the selectionBeginIndex property (for TextField instances only).

staticread onlyselectionEndIndex:Int

Accesses the selectionEndIndex property (for TextField instances only).

staticshader:Shader

Accesses the shader property.

staticsharpness:Float

Accesses the sharpness property (for TextField instances only).

staticsmoothing:Bool

Accesses the smoothing property (for Video or Bitmap instances only).

staticsoftKeyboardInputAreaOfInterest:Rectangle

Accesses the softKeyboardInputAreaOfInterest property (for InteractiveObject instances only).

staticread onlystage:Stage

Accesses the stage property.

staticstyleSheet:StyleSheet

Accesses the styleSheet property (for TextField instances only).

statictabChildren:Bool

Accesses the tabChildren property (for DisplayObjectContainer instances only).

statictabEnabled:Bool

Accesses the tabEnabled property (for InteractiveObject instances only).

statictabIndex:Int

Accesses the tabIndex property (for InteractiveObject instances only).

statictext:UTF8String

Accesses the text property (for StaticText or TextField instances only).

statictextColor:Int

Accesses the textColor property (for TextField instances only).

staticread onlytextHeight:Float

Accesses the textHeight property (for TextField instances only).

staticread onlytextWidth:Float

Accesses the textWidth property (for TextField instances only).

statictileAlphaEnabled:Bool

Accesses the tileAlphaEnabled property (for Tilemap instances only).

statictileBlendModeEnabled:Bool

Accesses the tileBlendModeEnabled property (for Tilemap instances only).

statictileColorTransformEnabled:Bool

Accesses the tileColorTransformEnabled property (for Tilemap instances only).

statictileset:Tileset

Accesses the tileset property (for Tilemap instances only).

staticread onlytotalFrames:Int

Accesses the totalFrames property (for MovieClip instances only).

statictransform:Transform

Accesses the transform property.

statictype:TextFieldType

Accesses the type property (for TextField instances only).

staticuseHandCursor:Bool

Accesses the useHandCursor property (for Sprite instances only).

staticread onlyvideoWidth:Int

Accesses the videoWidth property (for Video instances only).

staticvisible:Bool

Accesses the visible property.

staticwidth:Float

Accesses the width property.

staticwordWrap:Bool

Accesses the wordWrap property (for TextField instances only).

staticx:Float

Accesses the x property.

staticy:Float

Accesses the y property.

Static methods

staticaddChild(this:T, child:DisplayObject):DisplayObject

Accesses the addChild method (for DisplayObjectContainer instances only).

staticaddChildAt(this:T, child:DisplayObject, index:Int):DisplayObject

Accesses the addChildAt method (for DisplayObjectContainer instances only).

@:value({ useWeakReference : false, priority : 0, useCapture : false })staticaddEventListener<T2>(this:T, type:EventType<T2>, listener:T2 ‑> Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void

Accesses the addEventListener method.

staticaddFrameScript(this:T, index:Int, method:() ‑> Void):Void

Accesses the addFrameScript method (for MovieClip instances only).

staticaddTile(this:T, tile:Tile):Tile

Accesses the addTile method (for Tilemap instances only).

staticaddTileAt(this:T, tile:Tile, index:Int):Tile

Accesses the addTileAt method (for Tilemap instances only).

staticaddTiles(this:T, tiles:Array<Tile>):Array<Tile>

Accesses the addTiles method (for Tilemap instances only).

staticappendText(this:T, text:String):Void

Accesses the appendText method (for TextField instances only).

staticareInaccessibleObjectsUnderPoint(this:T, point:Point):Bool

Accesses the areInaccessibleObjectsUnderPoint method (for DisplayObjectContainer instances only).

staticattachNetStream(this:T, netStream:NetStream):Void

Accesses the attachNetStream method (for Video instances only).

staticattachTimeline(this:T, timeline:Timeline):Void

Accesses the attachTimeline method (for MovieClip instances only).

staticclear(this:T):Void

Accesses the clear method (for Video instances only).

staticcontains(this:T, child:Dynamic):Bool

Accesses the contains method (for Tilemap or DisplayObjectContainer instances only).

staticdispatchEvent(this:T, event:Event):Bool

Accesses the dispatchEvent method.

staticgetBounds(this:T, targetCoordinateSpace:DisplayObject):Rectangle

Accesses the getBounds method.

staticgetCharBoundaries(this:T, charIndex:Int):Rectangle

Accesses the getCharBoundaries method (for TextField instances only).

staticgetCharIndexAtPoint(this:T, x:Float, y:Float):Int

Accesses the getCharIndexAtPoint method (for TextField instances only).

staticgetChildAt(this:T, index:Int):DisplayObject

Accesses the getChildAt method (for DisplayObjectContainer instances only).

staticgetChildByName(this:T, name:String):DisplayObject

Accesses the getChildByName method (for DisplayObjectContainer instances only).

staticgetChildIndex(this:T, child:DisplayObject):Int

Accesses the getChildIndex method (for DisplayObjectContainer instances only).

staticgetFirstCharInParagraph(this:T, charIndex:Int):Int

Accesses the getFirstCharInParagraph method (for TextField instances only).

staticgetLineIndexAtPoint(this:T, x:Float, y:Float):Int

Accesses the getLineIndexAtPoint method (for TextField instances only).

staticgetLineIndexOfChar(this:T, charIndex:Int):Int

Accesses the getLineIndexOfChar method (for TextField instances only).

staticgetLineLength(this:T, lineIndex:Int):Int

Accesses the getLineLength method (for TextField instances only).

staticgetLineMetrics(this:T, lineIndex:Int):TextLineMetrics

Accesses the getLineMetrics method (for TextField instances only).

staticgetLineOffset(this:T, lineIndex:Int):Int

Accesses the getLineOffset method (for TextField instances only).

staticgetLineText(this:T, lineIndex:Int):String

Accesses the getLineText method (for TextField instances only).

staticgetObjectsUnderPoint(this:T, point:Point):Array<DisplayObject>

Accesses the getObjectsUnderPoint method (for DisplayObjectContainer instances only).

staticgetParagraphLength(this:T, charIndex:Int):Int

Accesses the getParagraphLength method (for TextField instances only).

staticgetRect(this:T, targetCoordinateSpace:DisplayObject):Rectangle

Accesses the getRect method.

@:value({ endIndex : -1, beginIndex : -1 })staticgetTextFormat(this:T, beginIndex:Int = -1, endIndex:Int = -1):TextFormat

Accesses the getTextFormat method (for TextField instances only).

staticgetTileAt(this:T, index:Int):Tile

Accesses the getTileAt method (for Tilemap instances only).

staticgetTileIndex(this:T, tile:Tile):Int

Accesses the getTileIndex method (for Tilemap instances only).

staticgetTiles(this:T):TileContainer

Accesses the getTiles method (for Tilemap instances only).

staticglobalToLocal(this:T, pos:Point):Point

Accesses the globalToLocal method.

@:value({ scene : null })staticgotoAndPlay(this:T, frame:Any, ?scene:String):Void

Accesses the gotoAndPlay method (for MovieClip instances only).

@:value({ scene : null })staticgotoAndStop(this:T, frame:Any, ?scene:String):Void

Accesses the gotoAndStop method (for MovieClip instances only).

statichasEventListener(this:T, type:String):Bool

Accesses the hasEventListener method.

statichitTestObject(this:T, obj:DisplayObject):Bool

Accesses the hitTestObject method.

@:value({ shapeFlag : false })statichitTestPoint(this:T, x:Float, y:Float, shapeFlag:Bool = false):Bool

Accesses the hitTestPoint method.

staticinvalidate(this:T):Void

Accesses the invalidate method.

staticlocalToGlobal(this:T, point:Point):Point

Accesses the localToGlobal method.

staticnextFrame(this:T):Void

Accesses the nextFrame method (for MovieClip instances only).

staticnextScene(this:T):Void

Accesses the nextScene method (for MovieClip instances only).

staticplay(this:T):Void

Accesses the play method (for MovieClip instances only).

staticprevFrame(this:T):Void

Accesses the prevFrame method (for MovieClip instances only).

staticprevScene(this:T):Void

Accesses the prevScene method (for MovieClip instances only).

staticremoveChild(this:T, child:DisplayObject):DisplayObject

Accesses the removeChild method (for DisplayObjectContainer instances only).

staticremoveChildAt(this:T, index:Int):DisplayObject

Accesses the removeChildAt method (for DisplayObjectContainer instances only).

@:value({ endIndex : 0x7FFFFFFF, beginIndex : 0 })staticremoveChildren(this:T, beginIndex:Int = 0, endIndex:Int = 0x7FFFFFFF):Void

Accesses the removeChildren method (for DisplayObjectContainer instances only).

@:value({ useCapture : false })staticremoveEventListener<T2>(this:T, type:EventType<T2>, listener:T2 ‑> Void, useCapture:Bool = false):Void

Accesses the removeEventListener method.

staticremoveTile(this:T, tile:Tile):Tile

Accesses the removeTile method (for Tilemap instances only).

staticremoveTileAt(this:T, index:Int):Tile

Accesses the removeTileAt method (for Tilemap instances only).

@:value({ endIndex : 0x7fffffff, beginIndex : 0 })staticremoveTiles(this:T, beginIndex:Int = 0, endIndex:Int = 0x7fffffff):Void

Accesses the removeTiles method (for Tilemap instances only).

staticreplaceSelectedText(this:T, value:String):Void

Accesses the replaceSelectedText method (for TextField instances only).

staticreplaceText(this:T, beginIndex:Int, endIndex:Int, newText:String):Void

Accesses the replaceText method (for TextField instances only).

staticrequestSoftKeyboard(this:T):Bool

Accesses the requestSoftKeyboard method (for InteractiveObject instances only).

staticsetChildIndex(this:T, child:DisplayObject, index:Int):Void

Accesses the setChildIndex method (for DisplayObjectContainer instances only).

staticsetSelection(this:T, beginIndex:Int, endIndex:Int):Void

Accesses the setSelection method (for TextField instances only).

@:value({ endIndex : -1, beginIndex : -1 })staticsetTextFormat(this:T, format:TextFormat, beginIndex:Int = -1, endIndex:Int = -1):Void

Accesses the setTextFormat method (for TextField instances only).

staticsetTileIndex(this:T, tile:Tile, index:Int):Void

Accesses the setTileIndex method (for Tilemap instances only).

staticsetTiles(this:T, group:TileContainer):Void

Accesses the setTiles method (for Tilemap instances only).

staticsortTiles(this:T, compareFunction:(Tile, Tile) ‑> Int):Void

Accesses the sortTiles method (for Tilemap instances only).

@:value({ bounds : null, lockCenter : false })staticstartDrag(this:T, lockCenter:Bool = false, ?bounds:Rectangle):Void

Accesses the startDrag method (for Sprite instances only).

staticstop(this:T):Void

Accesses the stop method (for MovieClip instances only).

staticstopAllMovieClips(this:T):Void

Accesses the stopAllMovieClips method (for DisplayObjectContainer instances only).

staticstopDrag(this:T):Void

Accesses the stopDrag method (for Sprite instances only).

staticswapChildren(this:T, child1:DisplayObject, child2:DisplayObject):Void

Accesses the swapChildren method (for DisplayObjectContainer instances only).

staticswapChildrenAt(this:T, index1:Int, index2:Int):Void

Accesses the swapChildrenAt method (for DisplayObjectContainer instances only).

staticswapTiles(this:T, tile1:Tile, tile2:Tile):Void

Accesses the swapTiles method (for Tilemap instances only).

staticswapTilesAt(this:T, index1:Int, index2:Int):Void

Accesses the swapTilesAt method (for Tilemap instances only).

statictoString(this:T):String

Accesses the toString method.

staticwillTrigger(this:T, type:String):Bool

Accesses the willTrigger method.