# DisplayObject error

**URL:** <https://forum.kirupa.com/t/displayobject-error/302320>\
**Category:** flash\
**Created:** [December 27, 2009, 6:53am UTC](https://forum.kirupa.com/t/displayobject-error/302320 "2009-12-27T06:53:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phastings](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@phastings](https://forum.kirupa.com/u/phastings)\
**Post date:** [December 27, 2009, 6:53am UTC](https://forum.kirupa.com/t/displayobject-error/302320/1 "2009-12-27T06:53:14Z")

</div>

i’m looping though a display object and trying to reset some button. the issue i’m having is i’m getting and error:  
1119: Access of possibly undefined property menuText through a reference with static type flash.display:DisplayObject.

on the line where i try and target obj.menuText below. the weird thing is that this same code works when the actionscript isn’t in a document class. i think i’m importing all the classes i need. also in the document class i had to add the MovieClip(obj) as pointed out below or i’d get an error similar to the one about. any idea why moving this into a package is causing this?

public function resetMenu() {  
//Loop through all of the menu itemsd  
for (var i:int=0; i\<menuHolder.numChildren; i++) {

```
            var obj:DisplayObject=menuHolder.getChildAt(i);

            //Set menu button to Off state
            TweenMax.to(obj.menuText,1,{tint:0x000000}); // GET ERROR HERE
            //Make menu button active and add listeners
            MovieClip(obj).mouseEnabled=true; //NOT IN PACKAGE THIS WAS JUST obj.mouseEnabled=
            obj.addEventListener(MouseEvent.MOUSE_OVER,mouseOverItem,false,0,true);
            obj.addEventListener(MouseEvent.MOUSE_OUT,mouseOutItem,false,0,true);
            obj.addEventListener(MouseEvent.CLICK,itemClicked,false,0,true);
        }
    }
```
