# AS3 Roll-over troubles

**URL:** <https://forum.kirupa.com/t/as3-roll-over-troubles/324932>\
**Category:** flash\
**Created:** [September 16, 2011, 1:22pm UTC](https://forum.kirupa.com/t/as3-roll-over-troubles/324932 "2011-09-16T13:22:30Z")\
**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 16, 2011, 1:22pm UTC](https://forum.kirupa.com/t/as3-roll-over-troubles/324932/1 "2011-09-16T13:22:30Z")

</div>

I’ve been having a problem getting roll-over/roll-off to work in AS3. I have a movie clip (Tick1) that I want to act like an AS2 button: roll-over diplays some text, roll off and the text goes away, click and go to a frame in the animation. the problem is that when I add a second event listener the first seems to be replaced, and the then third event listener replaces the second. Here is the code:

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  
{  
trace (“Mouse over now”);  
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  
{  
trace (“Mouse off now”);  
txtField.text = “Yikes”; //Yikes was added so i couod see the result - I will later add “”  
Tick1.buttonMode = true;  
}

This code makes only one thing happen - on mouse over the Mouse out function runs. Clikc doesn’t work and the “Yikes” is placed without
