# Problems with referencing the stage

**URL:** <https://forum.kirupa.com/t/problems-with-referencing-the-stage/276529>\
**Category:** flash\
**Created:** [November 30, 2008, 7:19am UTC](https://forum.kirupa.com/t/problems-with-referencing-the-stage/276529 "2008-11-30T07:19:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdev](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mdev](https://forum.kirupa.com/u/mdev)\
**Post date:** [November 30, 2008, 7:19am UTC](https://forum.kirupa.com/t/problems-with-referencing-the-stage/276529/1 "2008-11-30T07:19:00Z")

</div>

Hi,

I’m fairly new to Flash and actionscript, and it seems I haven’t fully understood how the stage should be referenced when you start moving down in the object hierarchy.

Hopefully someone here can help me shed a light on what I’m doing wrong.

In this particular example, I have two classes - Main.as and Engine.as, both extending MovieClip. In Main.as, I instanciate Engine and pass along a reference to main stage:

gameEngine = new Engine( this.stage );

This appears to work all fine and dandy, in Engine I do the following:

- In the constructor, this.stageRoot is set to the stage reference that is passed along
- The real problem seems to come when I try to do the following:

this.stageRoot.addEventListener( MouseEvent.MOUSE\_MOVE, mouseMoveHandler );

When I try to trace the event from the mouseMoveHandler function, I get the event properties. However, if I try to reference the properties, i.e. event.localY or stageY, I just get the following error:

Engine.as:60: 1119: Access of possibly undefined property localY through a reference with static type flash.events:Event.

I don’t understand why this happens, but it’s obvious that I’m doing something wrong. Thanks in advance for any and all help!
