# Function not running in a class

**URL:** <https://forum.kirupa.com/t/function-not-running-in-a-class/219465>\
**Category:** flash\
**Created:** [March 16, 2007, 5:32pm UTC](https://forum.kirupa.com/t/function-not-running-in-a-class/219465 "2007-03-16T17:32:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mprzybylski](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mprzybylski/32/613_2.png) [@mprzybylski](https://forum.kirupa.com/u/mprzybylski)\
**Post date:** [March 16, 2007, 5:32pm UTC](https://forum.kirupa.com/t/function-not-running-in-a-class/219465/1 "2007-03-16T17:32:35Z")

</div>

Hey guys,  
I’ve got a bit of an odd issue. I have a class called UIObject that has a private property called \_id. I have a getter/setter for it, and I extend UIObject by a class, lets say, MenuButton. Inside of MenuButton I have this function:

```auto
public function create($id:Number):Void
    {
        this.id = $id;
        trace("=====> create");
    }

```

now, I have a Main class that activates my MenuButtons, and that code is here:

```auto

private function initMainMenu():Void
    {
        for (var i:Number = 0; i < 6; i++)
        {
            var ob:Object = new Object();
            ob.mc = this.menu_mc["item" + i + "_mc"];
            ob.mc.create(i);
            
            ob.mc.onRelease = function():Void
            {
                trace(this.id);
            };
        }
    }

```

I’ve used this code successfully in the past, but for some reason my past two projects, it has not worked and create never gets run. I’ve tried time and time again to figure out why this isn’t working all of a sudden, but I can’t. I imagine i’m missing some very small detail and I need someone to point it out to me. Any help is greatly appreciated. Thanks.

- Matt
