# AS3 OOP - calling Main.function does not work

**URL:** <https://forum.kirupa.com/t/as3-oop-calling-main-function-does-not-work/284129>\
**Category:** flash\
**Created:** [March 15, 2009, 7:30pm UTC](https://forum.kirupa.com/t/as3-oop-calling-main-function-does-not-work/284129 "2009-03-15T19:30:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xchrisx](https://avatars.discourse-cdn.com/v4/letter/x/c89c15/32.png) [@xchrisx](https://forum.kirupa.com/u/xchrisx)\
**Post date:** [March 15, 2009, 7:30pm UTC](https://forum.kirupa.com/t/as3-oop-calling-main-function-does-not-work/284129/1 "2009-03-15T19:30:17Z")

</div>

This has been stumping me for days, maybe you can help. I can’t seem to access functions (methods) of my document class from any other class in the same package. What i need to do is create some global functions like menu reset, title change, etc. Maybe i’m not fully understanding the OOP concept, because this seems simple and it should totally work, but it doesn’t and no documentation has been able to tell me why.

I have a document class called Main.as like this:

```auto
package 
{
	import flash.display.Sprite;
	import flash.text.TextField;	

	public class Main extends Sprite
	{		
		public var myText:TextField = new TextField();
		
		public function Main() 
		{		
			myText.text = "Hello.";
			addChild(myText);
		} 
		
		public function change_text() {
			myText.text = "Hello there.";
		}
		
	} 
} 

```

Works great. Then I have a MovieClip on the stage with the Linkage class Item.as:

```auto
package 
{
	import flash.display.MovieClip;
	import flash.text.TextField;	
	
	public class Item extends MovieClip
	{		
		public function Item() 
		{		
			Main.change_text();
		} 
	} 
}

```

But for some reason it gives me the error:

```auto
Item.as, Line 10 : 1061: Call to a possibly undefined method change_text through a reference with static type Class.

```

Your help is **greatly** appreciated.
