# Call function inside a Class

**URL:** <https://forum.kirupa.com/t/call-function-inside-a-class/167132>\
**Category:** flash\
**Created:** [October 25, 2005, 7:06pm UTC](https://forum.kirupa.com/t/call-function-inside-a-class/167132 "2005-10-25T19:06:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balala](https://avatars.discourse-cdn.com/v4/letter/b/df705f/32.png) [@Balala](https://forum.kirupa.com/u/Balala)\
**Post date:** [October 25, 2005, 7:06pm UTC](https://forum.kirupa.com/t/call-function-inside-a-class/167132/1 "2005-10-25T19:06:50Z")

</div>

Hello.

I’ve got some problems trying to call a function inside a mc in a class.

For example:

```auto
class Foo {
  private my_mc:MovieClip;
  private my_mc2:MovieClip;
  
  public function Foo(mc:MovieClip, mc2:MovieClip) {
    my_mc = mc; // call the class, passing as parameter a movie clip
    my_mc2 = mc2;
    
    applyAS();
  }
  
  public function applyAS():Void {
    getMC2Height(); // Here the trace output prints the my_mc2._height
    my_mc.onEnterFrame = function():Void {
      getMC2Height(); // Here, doesnt =/
    }
  }
  
  public function getMC2Height():Void {
    trace(my_mc2._height);
  }
}

```

I didnt have such experience on AS2 OOP, but this is make me real crazy… Any suggestions about the class are welcome too.
