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