# Call a function from the Document class in another class

**URL:** <https://forum.kirupa.com/t/call-a-function-from-the-document-class-in-another-class/321475>\
**Category:** Uncategorized\
**Created:** [April 20, 2011, 8:10pm UTC](https://forum.kirupa.com/t/call-a-function-from-the-document-class-in-another-class/321475 "2011-04-20T20:10:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [April 20, 2011, 8:10pm UTC](https://forum.kirupa.com/t/call-a-function-from-the-document-class-in-another-class/321475/1 "2011-04-20T20:10:00Z")

</div>

I have a Document class that instantiates a class named Other. I need to call a function in the Other class from the Document class.  
I’m getting this error

Call to a possibly undefined method OtherFunction through a reference with static type Other.

I have read online that you need to use make the functions static or use a getter function but I’m unclear how to do that. I haven’t been able to make it work and I feel like i’m missing something fundemental with this problem. Will someone show me how to make this work.  
thanks in advance.

below are simplified versions of the classes.

Document class

```auto
package {
    
    import flash.display.MovieClip;
    import Other;

    public class DocumentClass extends MovieClip {
    
    public function DocumentClass(){ 
    

        var other:Other = new Other();
        other.OtherFunction();
        
        
        }    
    }
    
}

```

Other Class

```auto

package {
    import flash.display.MovieClip;
    public class Other extends MovieClip{

    public function Other() {

            function OtherFunction(){
            trace("OtherFunction");
            }
            
            
        }

    }
    
}

```
