# Function help

**URL:** <https://forum.kirupa.com/t/function-help/246605>\
**Category:** Uncategorized\
**Created:** [December 12, 2007, 6:37pm UTC](https://forum.kirupa.com/t/function-help/246605 "2007-12-12T18:37:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trxjw](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Trxjw](https://forum.kirupa.com/u/Trxjw)\
**Post date:** [December 12, 2007, 6:37pm UTC](https://forum.kirupa.com/t/function-help/246605/1 "2007-12-12T18:37:02Z")

</div>

Hey everyone, I’ve got a quick question regarding some of the functions I’m writing. Basically this function is not working when I call it, but actually runs when the frame loads and returns the trace data requested in the function.

Here’s the function:

```auto
function loadNewProj(projNumber:Number) {
    portfolioMain.projTitleTxt.text = _root.projArray[projNumber].projTitle;
    portfolioMain.projDescTxt.text = _root.projArray[projNumber].projDesc;
    portfolioMain.projTypeTxt.text = _root.projArray[projNumber].projType;
    trace(_root.projArray[projNumber].projType);
    trace(projNumber);
}

```

…and an example of how I’m calling it:

```auto
portfolioMain.wwwBtn.onRelease = loadNewProj(1);

```

I’m using the same function for about 12 different movieclips, so I realize this might be easier to do with a class than a function. However… I’m new to the OOP realm and I’m under the gun to finish this project (read: due tomorrow). Anyone have any suggestions? I can’t grasp why the function would run and work when the frame loads, but then not work when its called later on. Thanks. :thumb:
