# Reference to child by "level" not instance name

**URL:** <https://forum.kirupa.com/t/reference-to-child-by-level-not-instance-name/309363>\
**Category:** Uncategorized\
**Created:** [May 12, 2010, 9:55pm UTC](https://forum.kirupa.com/t/reference-to-child-by-level-not-instance-name/309363 "2010-05-12T21:55:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrT1976](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@MrT1976](https://forum.kirupa.com/u/MrT1976)\
**Post date:** [May 12, 2010, 9:55pm UTC](https://forum.kirupa.com/t/reference-to-child-by-level-not-instance-name/309363/1 "2010-05-12T21:55:47Z")

</div>

Hi everyone,

The following code works fine. However, rather than refering to the child by instance name I want to use something like the as2 \_level1.gotoAndStop.

The idea is that it’ll work for any .swf that is added using addChildAt(1) and therefore avoid having to repeat the code for lots of different .swfs

Do anyone have any ideas?

Thanks in advance,

MrT

```auto
stop();

var thisMovieClip:MovieClip;

var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
thisLoader.load( new URLRequest("ext.swf") );

function doneLoading(evt:Event):void {
    thisMovieClip = MovieClip(thisLoader.content);
    stage.addChildAt(thisMovieClip, 1);
    thisMovieClip.stop();

}

butt1.addEventListener(MouseEvent.CLICK, startMotion);

function startMotion(evt:MouseEvent):void {
    thisMovieClip.gotoAndStop(3);

}

```
