# Calling main function from inside a function

**URL:** https://forum.kirupa.com/t/calling-main-function-from-inside-a-function/306579
**Category:** flash
**Created:** [March 17, 2010, 8:59pm UTC](https://forum.kirupa.com/t/calling-main-function-from-inside-a-function/306579 "2010-03-17T20:59:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![marwan\_aziz](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@marwan\_aziz](https://forum.kirupa.com/u/marwan_aziz)
#### Post date: [March 17, 2010, 8:59pm UTC](https://forum.kirupa.com/t/calling-main-function-from-inside-a-function/306579/1 "2010-03-17T20:59:02Z")

</div>

I have onEnterFrame function that calls a function on the root of the class

```auto

public function PlayNext(){
_mcList[_currentVid].onEnterFrame = function() {
    
            //trace(this + ": " +"On enter frame");
            if (this._currentframe == this._totalframes) {
                trace(this+"reached the end");
                
                SetCurrentVideo();
                
            }
        }
}
public function SetCurrentVideo(){

trace("SetCurrentVideo");
}

```

but the function is not being called :S any ideas

Thanks in advance
