# addChild problems

**URL:** <https://forum.kirupa.com/t/addchild-problems/278412>\
**Category:** flash\
**Created:** [December 29, 2008, 5:59pm UTC](https://forum.kirupa.com/t/addchild-problems/278412 "2008-12-29T17:59:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ineedsleep](https://avatars.discourse-cdn.com/v4/letter/i/e5b9ba/32.png) [@Ineedsleep](https://forum.kirupa.com/u/Ineedsleep)\
**Post date:** [December 29, 2008, 5:59pm UTC](https://forum.kirupa.com/t/addchild-problems/278412/1 "2008-12-29T17:59:35Z")

</div>

I have just started learning AS3.0 but I used AS2.0 for a while.

I am just trying to add movie clips from the library and the script I have in the function works fine on the time line but when I put it the class it no longer works or at least I dont think it gets added to the display list but it doesnt show.

Here is my code I think it could be to do with the classes imported at the top of the class.

```auto
 
package com{
 import flash.display.MovieClip;
 import flash.display.Sprite;
 import flash.events.*;
 import flash.display.*;
 import flash.text.TextField;
 import flash.net.*;
 public class gallery extends MovieClip {
  //public var gfx:Stephen = new Stephen();
  
  public function gallery(mainArray) {
   Main();
   init(mainArray);
  }
  public function init(mainArray) {
   createFirstLevelMenu(mainArray);
  }//
  public function Main() {
  
  
  var test:Test = new Test();
  addChild(test);
  
  }

  public function createFirstLevelMenu(mainArray) {
   var container:MovieClip = new MovieClip();
   addChild(container);
   var gfx:Stephen=new Stephen(); //Stephen is a symbol in the library and has the same instance name
   container.addChild(gfx);
   trace(this.numChildren);//traces 1
  }
 }

```

it definitely calls the class and the function.

I am completely stuck any help would be appreciated.

Many thanks

Stephen
