# Need help with university project, AS error

**URL:** <https://forum.kirupa.com/t/need-help-with-university-project-as-error/331454>\
**Category:** flash\
**Created:** [August 4, 2013, 6:05pm UTC](https://forum.kirupa.com/t/need-help-with-university-project-as-error/331454 "2013-08-04T18:05:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zimatrix](https://avatars.discourse-cdn.com/v4/letter/z/aeb1de/32.png) [@Zimatrix](https://forum.kirupa.com/u/Zimatrix)\
**Post date:** [August 4, 2013, 6:05pm UTC](https://forum.kirupa.com/t/need-help-with-university-project-as-error/331454/1 "2013-08-04T18:05:28Z")

</div>

Hey guys, I’m completely new to flash and I’m actually trying to make an interactive document for a university project. So far everything has gone pretty well, I’ve managed to look up tutorials and learn as I go but now I’ve hit a bit of a wall. I’m gonna try to explain this as best as I can and I’ll copy my AS codes below.

So after a few text animations I have a screen with four buttons and four movie clips - button1 activates movie clip1 etc the problem is when I try to code this it doesn’t seem to work, I get a duplicate function error and a button from the beginning of the animation also stops working.

Here’s the code I was told to use:

> stop();

function handleClick(pEvent:MouseEvent):void {  
TextBox1.gotoAndPlay(2);  
}

Button1.addEventListener(MouseEvent.MOUSE\_UP, handleClick);

This code works fine on its own, it makes button1 activate textbox1 (which is my movie clip) So I thought it would work if I copy pasted this and just changed the numbers so my code looked like this

> stop();

function handleClick(pEvent:MouseEvent):void {  
TextBox1.gotoAndPlay(2);  
}

Butto1.addEventListener(MouseEvent.MOUSE\_UP, handleClick);

function handleClick(pEvent:MouseEvent):void {  
TextBox2.gotoAndPlay(2);  
}

Button2.addEventListener(MouseEvent.MOUSE\_UP, handleClick);

function handleClick(pEvent:MouseEvent):void {  
TextBox3.gotoAndPlay(2);  
}

Button3.addEventListener(MouseEvent.MOUSE\_UP, handleClick);

function handleClick(pEvent:MouseEvent):void {  
TextBox4.gotoAndPlay(2);  
}

Button4.addEventListener(MouseEvent.MOUSE\_UP, handleClick);

But this is what broke it, suddenly none of my buttons were working. I did some research and found out that them all saying “function handleClick” could be the problem so I added 1,2,3 and 4 to the end of each one respectively and still it wouldn’t work. Like I said it broke the button from earlier in my animation too, I’ll paste the code for that as well.

> NextStage.addEventListener(MouseEvent.CLICK, fl\_ClickToGoToAndPlayFromFrame\_4);

function fl\_ClickToGoToAndPlayFromFrame\_4(event:MouseEvent):void  
{  
gotoAndPlay(961);  
}

This is where I’m currently stuck. I have no idea how to code these four buttons/movie clips and it’s the last step in my animation, once I get this sorted out I’m pretty much done with the project.

Thanks for reading this all so far down, I know it’s pretty long, hopefully I’ve just made a really stupid mistake and it’s an easy fix.
