# Calling a function inside another function

**URL:** <https://forum.kirupa.com/t/calling-a-function-inside-another-function/264846>\
**Category:** Uncategorized\
**Created:** [July 1, 2008, 4:56am UTC](https://forum.kirupa.com/t/calling-a-function-inside-another-function/264846 "2008-07-01T04:56:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashdaddy](https://avatars.discourse-cdn.com/v4/letter/f/e36b37/32.png) [@flashdaddy](https://forum.kirupa.com/u/flashdaddy)\
**Post date:** [July 1, 2008, 4:56am UTC](https://forum.kirupa.com/t/calling-a-function-inside-another-function/264846/1 "2008-07-01T04:56:14Z")

</div>

Hi All,

I’ve set up two functions (friendsClick and policyLink) I would like to use everything inside of friendsClick inside of policyLink but I’m not sure how to go about doing it. I get the following error:  
1136: Incorrect number of arguments. Expected 1.

My code looks similar to:

```auto

function policyLink(e:MouseEvent){
     friendsClick();
     "all my other info here"
}

```

I can just copy everything from the friendsClick function and paste, but I’m trying to limit my amount of repetitive code (I’m trying to get better at that). Please Help.

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [July 1, 2008, 5:58am UTC](https://forum.kirupa.com/t/calling-a-function-inside-another-function/264846/2 "2008-07-01T05:58:49Z")

</div>

You probably should have posted more of the relevant code, since I can think of a few things that might be causing the issue.

Try:

```auto
function policyLink(e:MouseEvent = null)

```

Or:

```auto
friendsClick(null);

```

It’s probably the first one, but I can’t be sure.

---

<div class="post-metadata">

**Author:** ![flashdaddy](https://avatars.discourse-cdn.com/v4/letter/f/e36b37/32.png) [@flashdaddy](https://forum.kirupa.com/u/flashdaddy)\
**Post date:** [July 2, 2008, 12:27am UTC](https://forum.kirupa.com/t/calling-a-function-inside-another-function/264846/3 "2008-07-02T00:27:10Z")

</div>

[quote=flashdaddy;2351697]Hi All,

I’ve set up two functions (friendsClick and policyLink) I would like to use everything inside of friendsClick inside of policyLink but I’m not sure how to go about doing it. I get the following error:  
1136: Incorrect number of arguments. Expected 1.

My code looks similar to:

```auto

function policyLink(e:MouseEvent){
     friendsClick();
     "all my other info here"
}

```

I can just copy everything from the friendsClick function and paste, but I’m trying to limit my amount of repetitive code (I’m trying to get better at that). Please Help.[/quote]

I got the problem solved. Apparently you can’t put a function inside another function when you have an event listener associated with it. I had to do something like this:

```auto
oldFunction.addEventListener(MouseEvent.CLICK, btn_Fade);

function oldFunction(e:MouseEvent){
     newFunction();
}

function newFunction(e:MouseEvent){
     "all my functions"
}

```

Something like that anyway. It worked out for me though. Thanks to all those who helped out.
