Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Alpha value on Mouse Roll Over?

Status
Not open for further replies.

Tr0

Programmer
Jul 12, 2007
24
0
0
US
I'm a total newb to flash, I am using ActionScript 3.0 and all I'm trying to do is when the mouse rolls over a button it changes the alpha value to 50%.


Here's the code I'm using:
function onRollovr(evt:MouseEvent):void {
this.alpha = 50;
}
img1_btn.addEventListener(MouseEvent.ROLL_OVER,onRollovr);


Besides using the this.alpha approach, I've also tried _alpha and alpha which doesn't work either.

Any suggestions?
 
Nevermind I figured it out.

Here's the code incase anyone is interested:

var newbutton:Sprite = new Sprite();
addChild(img1_btn);
img1_btn.addEventListener(MouseEvent.MOUSE_OVER,doOver);
img1_btn.addEventListener(MouseEvent.MOUSE_OUT,doOut);
function doOver(event:MouseEvent)
{
event.target.alpha = 0.5;
}
function doOut(event:MouseEvent)
{
event.target.alpha = 1;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top