# Difference between this.instanceName and this.getChildByName(instanceName)

**URL:** <https://forum.kirupa.com/t/difference-between-this-instancename-and-this-getchildbyname-instancename/297766>\
**Category:** flash\
**Created:** [October 8, 2009, 6:31am UTC](https://forum.kirupa.com/t/difference-between-this-instancename-and-this-getchildbyname-instancename/297766 "2009-10-08T06:31:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![biggie\_mac](https://avatars.discourse-cdn.com/v4/letter/b/aca169/32.png) [@biggie\_mac](https://forum.kirupa.com/u/biggie_mac)\
**Post date:** [October 8, 2009, 6:31am UTC](https://forum.kirupa.com/t/difference-between-this-instancename-and-this-getchildbyname-instancename/297766/1 "2009-10-08T06:31:35Z")

</div>

Hi,

i’m a little new to Flash and I haven’t managed to figure this out yet:  
What is the difference between dragging a movieClip to stage from the user interface and inserting it from code? What I mean is…I noticed that if I drag a movie clip from the library to the stage, give it an instance name (‘xx’), I can access it from code using “this.xx”. However, if I add the movieClip from code using:

var ch = new MovieClip();  
ch.name = ‘xx’;  
addChild(ch);

I cannot access it using this.xx, but I have to access it using this.getChildByName(‘xx’);

Why is that? Shouldn’t the 2 processes(dragging and adding by code) do pretty much the same thing?  
10x in advance and sorry if the question might sound silly.  
Cheers
