# Multiple event handlers on one object

**URL:** <https://forum.kirupa.com/t/multiple-event-handlers-on-one-object/324974>\
**Category:** flash\
**Created:** [September 19, 2011, 12:37am UTC](https://forum.kirupa.com/t/multiple-event-handlers-on-one-object/324974 "2011-09-19T00:37:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSlish](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@DSlish](https://forum.kirupa.com/u/DSlish)\
**Post date:** [September 19, 2011, 12:37am UTC](https://forum.kirupa.com/t/multiple-event-handlers-on-one-object/324974/1 "2011-09-19T00:37:08Z")

</div>

I’m new to AS3 and trying to turn a Movie Clip into a classic button - roll-over to display text, roll-off and text goes away, click and go to frame of animation. Each works on its own but when I put all 3 on the same Movie Clip (Tick1) each succeeding event listener seems to erase the previous one. Am I doing something wrong? Here is the code:

var txtField:TextField = new TextField();  
Tick1.addEventListener(MouseEvent.CLICK, GoToStart);  
Tick1.buttonMode = true;  
Tick1.addEventListener(MouseEvent.MOUSE\_OVER, MouseOverTick1);  
Tick1.addEventListener(MouseEvent.MOUSE\_OUT, MouseOutTick1);  
function GoToStart(event:MouseEvent):void  
{ gotoAndStop(1);}  
function MouseOverTick1(event:MouseEvent):void  
{ txtField.text = “Vesicle Formation”;  
txtField.x = 120;  
txtField.y = 385;  
addTextField ();}  
function addTextField ():void  
{ var myFormat:TextFormat = new TextFormat();  
myFormat.color = 0x000000;  
myFormat.size = 10;  
txtField.setTextFormat(myFormat);  
addChild (txtField);}  
function MouseOutTick1(event:MouseEvent):void  
//just adding some text to see if it works - will replace with “” when it does  
txtField.text = “Yikes”; }
