# Related classes

**URL:** https://forum.kirupa.com/t/related-classes/302362
**Category:** Uncategorized
**Created:** [December 28, 2009, 8:16pm UTC](https://forum.kirupa.com/t/related-classes/302362 "2009-12-28T20:16:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dvinatea](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@dvinatea](https://forum.kirupa.com/u/dvinatea)
#### Post date: [December 28, 2009, 8:16pm UTC](https://forum.kirupa.com/t/related-classes/302362/1 "2009-12-28T20:16:39Z")

</div>

[COLOR=black][FONT=Verdana]I have two classes: one that builds a menu (state.as) and the other that resizes an object so that it is vertically on the center of the stage and has the stage width (myStage.as)[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]myStage has a parameter that is the object you want to resize:[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]var mystage:myStage = new myStage(backround);[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]When clicking one button of the menu, the background disappears (background.visible=false) .[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]One class (state) has an effect over the other (myStage) when the background visibility is turned to false.[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]What I did is to load a variable “mystage” belonging to the class myStage in the class “state”. In the class “state” are the buttons. So when you click a button, the backround.visible=false[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]It doesn’t work. I throws an error: **[FONT=Verdana]error[/FONT]** #**[FONT=Verdana]1009[/FONT]**:**[FONT=Verdana]Cannot access a property or method of a null object reference.[/FONT]**[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]**[FONT=Verdana][/FONT]**[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]**[FONT=Verdana]thank you.[/FONT]**[/FONT][/COLOR]
