# Problem with classes

**URL:** https://forum.kirupa.com/t/problem-with-classes/298403
**Category:** Uncategorized
**Created:** [October 18, 2009, 11:19am UTC](https://forum.kirupa.com/t/problem-with-classes/298403 "2009-10-18T11:19:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lope](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@lope](https://forum.kirupa.com/u/lope)
#### Post date: [October 18, 2009, 11:19am UTC](https://forum.kirupa.com/t/problem-with-classes/298403/1 "2009-10-18T11:19:02Z")

</div>

I have one class, which I am adding to stage, here is part of the code:

```auto
public class ThumbArea extends Sprite {
        
        private var _thumbAreaSprite:Sprite;
        
        public function ThumbArea( xml:XML ) {

            _xml = xml;
            
            addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true);
            addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler, false, 0, true);

        }
        
        private function addedToStageHandler(e:Event):void {
            
            removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
         
            _thumbSprite = new Sprite();
            addChild(_thumbSprite);
            trace("doh");

```

in my other class, I do this:

```auto

_thumbArea = new ThumbArea( _xml );
**addChild(_thumbArea);**
            
trace(_thumbArea.getThumbSprite());

```

and my output window traces:  
**null  
doh**

I dont get this, when I say **addChild(\_thumbArea);** shouldnt all the code in \_thumbArea execute first and then continue with code in my parent class?
