# I get 'undefined.' But why?

**URL:** <https://forum.kirupa.com/t/i-get-undefined-but-why/182800>\
**Category:** flash\
**Created:** [March 21, 2006, 3:08pm UTC](https://forum.kirupa.com/t/i-get-undefined-but-why/182800 "2006-03-21T15:08:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregmax17](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gregmax17/32/2243_2.png) [@gregmax17](https://forum.kirupa.com/u/gregmax17)\
**Post date:** [March 21, 2006, 3:08pm UTC](https://forum.kirupa.com/t/i-get-undefined-but-why/182800/1 "2006-03-21T15:08:56Z")

</div>

Ok, I am working a tile based game. In my tile movieClip, I have on tile with an instance name. So when the character moves on top of the tile it will do ‘something’. But I can’t get it to work. Here is the script:

game.Tile39 = function () { };  
game.Tile39.prototype.walkable = true;  
game.Tile39.prototype.frame = 39;

if(\_root.char.hitTest(\_root.tile.Tile39)) {

```
      //do this here

```

}

I am testing a hitTest collision between the character (char) and tile 39 (Tile39, in the instance name in the movieClip tile).

I have done a trace(\_root.tile.Tile39), but it gives me an ‘undefined’. Why is this?

Also, did I provide enough info so you can understand what I trying to get at?

---

<div class="post-metadata">

**Author:** ![pseudodigm](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@pseudodigm](https://forum.kirupa.com/u/pseudodigm)\
**Post date:** [March 21, 2006, 4:33pm UTC](https://forum.kirupa.com/t/i-get-undefined-but-why/182800/2 "2006-03-21T16:33:20Z")

</div>

> [@gregmax17](#):
>
> Ok, I am working a tile based game. In my tile movieClip, I have on tile with an instance name. So when the character moves on top of the tile it will do ‘something’. But I can’t get it to work. Here is the script:
> 
> game.Tile39 = function () { };  
> game.Tile39.prototype.walkable = true;  
> game.Tile39.prototype.frame = 39;
> 
> if(\_root.char.hitTest(\_root.tile.Tile39)) {
> 
> ```
> //do this here
> 
> ```
> 
> }
> 
> I am testing a hitTest collision between the character (char) and tile 39 (Tile39, in the instance name in the movieClip tile).
> 
> I have done a trace(\_root.tile.Tile39), but it gives me an ‘undefined’. Why is this?
> 
> Also, did I provide enough info so you can understand what I trying to get at?

I’m just a stupid designer, so I’m probably wrong…but shouldn’t you be tracing \_root.game.Tile39, not \_root.tile.Tile39?
