# 1 problem with custom function

**URL:** <https://forum.kirupa.com/t/1-problem-with-custom-function/202600>\
**Category:** Uncategorized\
**Created:** [October 2, 2006, 11:29pm UTC](https://forum.kirupa.com/t/1-problem-with-custom-function/202600 "2006-10-02T23:29:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![W84me](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/w84me/32/1257_2.png) [@W84me](https://forum.kirupa.com/u/W84me)\
**Post date:** [October 2, 2006, 11:29pm UTC](https://forum.kirupa.com/t/1-problem-with-custom-function/202600/1 "2006-10-02T23:29:43Z")

</div>

Hi all!

I have this code

```auto
var nameArray:Array = new Array("&#919;&#959;me", "Lessons", "Manuals", "Bibliografy");
var labelsArray:Array = new Array("start", "lessons", "bio", "contact");
function over() {
    this.gotoAndPlay(2);
}
function out() {
    this.gotoAndPlay(21);
}
function createMenu(numBut:Array, labels:Array, fontSize:Number) {
    this.createEmptyMovieClip("menu_mc", this.getNextHighestDepth());
    menu_mc._x = 100;
    menu_mc._y = 200;
    var tfFormatter:TextFormat = new TextFormat();
    tfFormatter.size = fontSize;
    tfFormatter.color = 0xFFFFFF;
    for (var i = 0; i<numBut.length; i++) {
        var button = menu_mc.attachMovie("button", "button"+i, menu_mc.getNextHighestDepth());
        button.but.butText.text = numBut*;
        button.but.butText.setTextFormat(tfFormatter);
        button._y = i*(button._height+2);
        button.onRollOver = over;
        button.onRollOut = out;
        button.onRelease = function() {
            trace(labels*);
            gotoAndPlay(labels*);
        };
    }
}
createMenu(nameArray, labelsArray, 12);

```

Well i have some labels at my timeline and i pass them as an array. The problem is at the onRelease event. It returns undefined. I cant figure out how to solve it…

Thanks in advance.
