# Help with error 1021: duplicate function definition

**URL:** <https://forum.kirupa.com/t/help-with-error-1021-duplicate-function-definition/311915>\
**Category:** flash\
**Created:** [July 20, 2010, 11:41am UTC](https://forum.kirupa.com/t/help-with-error-1021-duplicate-function-definition/311915 "2010-07-20T11:41:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivia\_Chapman](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@Olivia\_Chapman](https://forum.kirupa.com/u/Olivia_Chapman)\
**Post date:** [July 20, 2010, 11:41am UTC](https://forum.kirupa.com/t/help-with-error-1021-duplicate-function-definition/311915/1 "2010-07-20T11:41:44Z")

</div>

hey I’m creating a colouring in game for my HSC major project and  
was following a tutoral that gave me this code:

import flash.events.MouseEvent;  
back2colour.addEventListener(MouseEvent.CLICK, buttndow);  
function buttndow(event:MouseEvent):void{  
gotoAndStop(“36”);  
}  
//Colouring in set up  
red\_btn.addEventListener(MouseEvent.CLICK, pickColour);  
white\_btn.addEventListener(MouseEvent.CLICK, pickColour);  
blue\_btn.addEventListener(MouseEvent.CLICK, pickColour);  
green\_btn.addEventListener(MouseEvent.CLICK, pickColour);  
function pickColour(evt:MouseEvent) {  
if (evt.target.name==“red\_btn”) {  
arrow\_mc.y=133;  
}  
if (evt.target.name==“white\_btn”) {  
arrow\_mc.y=179;  
}  
if (evt.target.name==“blue\_btn”) {  
arrow\_mc.y=221;  
}  
if (evt.target.name==“green\_btn”) {  
arrow\_mc.y=264;  
}  
}  
middle\_mc.useHandCursor=true;  
middle\_mc.buttonMode=true;  
reflection1\_mc.useHandCursor=true;  
reflection1\_mc.buttonMode=true;  
reflection2\_mc.useHandCursor=true;  
reflection2\_mc.buttonMode=true;  
middle\_mc.addEventListener(MouseEvent.CLICK, changeColour);  
reflection1\_mc.addEventListener(MouseEvent.CLICK, changeColour);  
reflection2\_mc.addEventListener(MouseEvent.CLICK, changeColour);  
function changeColour(evt:MouseEvent) {  
trace(evt.target.name);  
}  
var red:ColorTransform = new ColorTransform(0,0,0,0,255,0,0,255);  
var blue:ColorTransform = new ColorTransform(0,0,0,0,0,0,255,255);  
var green:ColorTransform = new ColorTransform(0,0,0,0,0,255,0,255);  
var white:ColorTransform = new ColorTransform(0,0,0,0,255,255,255,255);  
var changeToColor:ColorTransform = new ColorTransform();  
changeToColor=red;  
function pickColor(evt:MouseEvent) {  
if (evt.target.name==“red\_btn”) {  
changeToColor=red;  
arrow\_mc.y=133;  
}  
if (evt.target.name==“white\_btn”) {  
changeToColor=white;  
arrow\_mc.y=179;  
}  
if (evt.target.name==“blue\_btn”) {  
changeToColor=blue;  
arrow\_mc.y=221;  
}  
if (evt.target.name==“green\_btn”) {  
changeToColor=green;  
arrow\_mc.y=264;  
}  
}  
function changeColour(evt:MouseEvent) {  
evt.target.transform.colorTransform=changeToColor;  
}

and I get the error 1021: duplicate function definition. I’m new to flash and actionscript 3.0 so could anyone help me out. I think its because I have this:

function changeColour(evt:MouseEvent) {  
trace(evt.target.name);  
and this:

function changeColour(evt:MouseEvent) {  
evt.target.transform.colorTransform=changeToColor;

I’ve tried putting them in the same function but that didn’t work and I tried making it a completely different name but that just made other errors occur. I really need help. I have no idea what I’m doing.
