I am newbbie in Flash CS5 and AS3 and I have a problem! I have 3 rectangles on stage converted in MovieClips with given instance names. All three have the property of color effect: alpha = 50. I have type the following code in as3 layer :
addEventListener(MouseEvent.ROLL_OVER, RollOverBtn);
addEventListener(MouseEvent.ROLL_OUT, RollOutBtn);
function RollOverBtn(event:MouseEvent):void
{
event.target.alpha = 100;
}
function RollOutBtn(event:MouseEvent):void
{
event.target.alpha = 50;
}
The problem is that when the mouse rolls over one rect, alpha changes to 100. But when the mouse rolls out, nothing happens!
Any suggestions?
I have changed my code to :
btn1.addEventListener(MouseEvent.ROLL_OVER, MouseOverBtn);
btn1.addEventListener(MouseEvent.ROLL_OUT, MouseOutBtn);
btn2.addEventListener(MouseEvent.ROLL_OVER, MouseOverBtn);
btn2.addEventListener(MouseEvent.ROLL_OUT, MouseOutBtn);
btn3.addEventListener(MouseEvent.ROLL_OVER, MouseOverBtn);
btn3.addEventListener(MouseEvent.ROLL_OUT, MouseOutBtn);
function MouseOverBtn(event:MouseEvent):void
{
trace("roll over"+event.target);
event.target.alpha = 1;
}
function MouseOutBtn(event:MouseEvent):void
{
trace("roll out"+event.target);
if(event.target.alpha == 100){
event.target.alpha = 0.5;
}
}
and the trace message I get is :
roll over[object MovieClip]
roll out[object MovieClip]
This, as I can understand means that the roll_out is triggered but still not changing alpha property.