# addChild is undefined method?

**URL:** https://forum.kirupa.com/t/addchild-is-undefined-method/289102
**Category:** flash
**Created:** [May 26, 2009, 11:39am UTC](https://forum.kirupa.com/t/addchild-is-undefined-method/289102 "2009-05-26T11:39:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ikonik](https://avatars.discourse-cdn.com/v4/letter/i/35a633/32.png) [@ikonik](https://forum.kirupa.com/u/ikonik)
#### Post date: [May 26, 2009, 11:39am UTC](https://forum.kirupa.com/t/addchild-is-undefined-method/289102/1 "2009-05-26T11:39:25Z")

</div>

I have four classes -

class Init - intialises some variables, and is the doc Class.  
class Street - loads XML data for, say, a number of streets in a particular area  
class House - loads in the houses data for one particular street  
class DisplayHouse - displays graphics on screen for the houses

This all seems to be working apart from the actual graphical display of objects.

In the ouput window I am seeing the results I need to see pertaining the the XML data loaded.

The problem is that in House - I have the code :

var new \_house = new DisplayHouse();  
addChild (\_house);

and DisplayHouse is a simple graphics-shape:

var drawHouse:Sprite=new Sprite();  
code… to draw house!

addChild(drawHouse);

Now, when I comile, I keep getting this error:

Location: House.as  
Description: 1180:call to undefined method addChild  
Source: addChild (\_house);

House extends sprite and has import Sprite and all that! - infact all the classes have the same imports and extend Sprite!

semi-colons are all in right places, there are no typos!

I simply cannot understand why addChild is an undefined method in this case!?!?!

any help out there, would be greatly appreciated.

Thanks!  
Ikonik
