# Traversing the display list. Should be easy

**URL:** <https://forum.kirupa.com/t/traversing-the-display-list-should-be-easy/245066>\
**Category:** Uncategorized\
**Created:** [November 26, 2007, 2:28am UTC](https://forum.kirupa.com/t/traversing-the-display-list-should-be-easy/245066 "2007-11-26T02:28:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankonline](https://avatars.discourse-cdn.com/v4/letter/f/958977/32.png) [@frankonline](https://forum.kirupa.com/u/frankonline)\
**Post date:** [November 26, 2007, 2:28am UTC](https://forum.kirupa.com/t/traversing-the-display-list-should-be-easy/245066/1 "2007-11-26T02:28:49Z")

</div>

Hi.

How am I supposed to address a shape within a sprite within a sprite?  
This code doesn’t work, so how is it supposed to be done?

```auto
package classes {
    
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.display.DisplayObject;
    
    public class Test extends Sprite {
        
        public function Test() {
            
            var container:Sprite = new Sprite();
            var sprite:Sprite = new Sprite();
            var shape:Shape = new Shape();
            
            sprite.name = 'sprite';
            shape.name = 'shape';
            
            this.addChild(container);
            container.addChild(sprite);
            sprite.addChild(shape);
            
            var object1:DisplayObject = container.getChildByName('sprite');
            var object2:DisplayObject = object1.getChildByName('shape');
            
            trace(object1); // Working
            trace(object2); // Error...
            
        }
        
    }
    
}

```

This produces the following error:

> 1061: Call to a possibly undefined method getChildByName through a reference with static type flash.display:DisplayObject.

I miss the AS2 path structure, like \_root.container.sprite.shape.\_visible = false;

How do I do this in AS3?

/ Frank
