# How to reference an array created in Doc Class

**URL:** <https://forum.kirupa.com/t/how-to-reference-an-array-created-in-doc-class/276688>\
**Category:** flash\
**Created:** [December 2, 2008, 6:59pm UTC](https://forum.kirupa.com/t/how-to-reference-an-array-created-in-doc-class/276688 "2008-12-02T18:59:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddivine](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@ddivine](https://forum.kirupa.com/u/ddivine)\
**Post date:** [December 2, 2008, 6:59pm UTC](https://forum.kirupa.com/t/how-to-reference-an-array-created-in-doc-class/276688/1 "2008-12-02T18:59:15Z")

</div>

Hi, I need to reference an array created in doc class that consists of Navigation Movie Clip objects.  
When the mouse over happens on one of those Nav Objects, I need to reference the array that I created in Doc Class.

Doc Class Code:  
var newPageNav:NavButton = new NavButton(sId,sTitle,sStatus);  
menuItems.push(newPageNav);  
addChild(newPageNav);

Now I need to remove them from the stage:  
So when the NavButton is clicked I need to go back through that array and remove items from the stage. But when I call a function from the NavButton:

public function onButtonClick(e:MouseEvent):void  
{  
removeSlide();  
}

the function that lives in the DocClass, removeSlide()

public function removeSlide():void {  
trace(menuItems.length.toString());  
}

trace returns 0, saying the array doesn’t exist.

Logically I understand that I am inside a NavButton class that has a handler, so even when I call removeSlide function at the Doc Class, I am still inside Nav Button Class.

So how do I get access to that array so I can remove elements from the stage.

Thank you very much for your time.  
-d.
