Kelso Brooks
Kelso Brooks

Reputation: 9

Actionscript 3.0 - Mouse_OVER, Mouse_OUT to show / hide items...?

Making a interactive tour guide where you mouse over an icon and information pops up (Images, text, etc...) I can get my test image to become visible on MOUSE_OVER but it does not become invisible when I MOUSE_OUT my icon/button. Here is what I have so far....

sthelens1 is an image

butt1 is my icon for the mouseto mouse over and out


sthelens1.visible =  false


butt1.addEventListener(MouseEvent.MOUSE_OVER,showImage);
butt1.addEventListener(MouseEvent.MOUSE_OUT,showImage);

function showImage(MouseEvent){ 
if(MouseEvent == "MOUSE_OUT"){
   sthelens1.visible = false;

}

if(MouseEvent = "MOUSE_OVER"){      
   sthelens1.visible = true;
} 
}

Any guidance or help would be appreciated..

Upvotes: 0

Views: 53

Answers (1)

Daniel
Daniel

Reputation: 35714

use (e:MouseEvent) and then you can get more info on the e variable.

You can also use a separate listener function on MOUSE_OUT

sthelens1.visible =  false


butt1.addEventListener(MouseEvent.MOUSE_OVER, showImage);
butt1.addEventListener(MouseEvent.MOUSE_OUT, hideImage);

function showImage(e:MouseEvent){ 
  sthelens1.visible = false;
}

function hideImage(e:MouseEvent){ 
  sthelens1.visible = true; 
}

Upvotes: 1

Related Questions