# Duplicate function definition

**URL:** <https://forum.kirupa.com/t/duplicate-function-definition/299843>\
**Category:** flash\
**Created:** [November 11, 2009, 7:30pm UTC](https://forum.kirupa.com/t/duplicate-function-definition/299843 "2009-11-11T19:30:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m00nb00ts](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@m00nb00ts](https://forum.kirupa.com/u/m00nb00ts)\
**Post date:** [November 11, 2009, 7:30pm UTC](https://forum.kirupa.com/t/duplicate-function-definition/299843/1 "2009-11-11T19:30:47Z")

</div>

I’m new to flash/AS and trying to create a flash movie that shows a frame (1) which has a ‘next’ button to move to second frame(2), pauses uses a timer, before moving onto the next frame (3) which then has a ‘next’ button to move to the third frame (4).

I’m building a presentation where the user has to pause to read the instructions on frame 2 before the next button appears.

My two Action Scripts are, on frame 1 :

```auto
stop();
next_btn.addEventListener(MouseEvent.CLICK,next_btnMouseClickEventHandler);

function next_btnMouseClickEventHandler(ev:MouseEvent):void
{
 nextFrame();
}

```

and on frame 2:

```auto
stop ();
setTimeout(function() { gotoAndPlay(3); }, 3000);

```

and then on frame 3:

```auto
stop();
next_btn.addEventListener(MouseEvent.CLICK,next_btnMouseClickEventHandler);

function next_btnMouseClickEventHandler(ev:MouseEvent):void
{
 nextFrame();
}

```

It doesn’t seem to like me calling the same function in two places (frames 1 and 3) and gives me an error ‘1021 Duplicate Function Definition’ but surely that is the point of a function, that you can call it many times??

I have worked around it by calling the button and the function a slightly different name each time it is used but this just don’t seem right. I’m sure it’s just a simple error on my part, can anyone help?

thanks
