Link to home
Start Free TrialLog in
Avatar of Cesar Aracena
Cesar AracenaFlag for Argentina

asked on

How do I appear/dissapear a button on MOUSE EVENT?

Hi all,

I'm trying to make my own flash player (not one of the packed ones gives me what I need) and I'm trying to make appear and dissapear the big middle "play/pause" button whn the user hovers the mouse. I've made a symbol (graphic) out of a JPG image and named it playBtn with Alpha = 0 (it will have auto play from the start) and solved all the AS3 errors in Flash CS5 but still the button don't appear (or dissapear if I start with Alpha = 100%).

Here's my code.

Any ideas?

Thanks in advance.
//Import for the Tween Class to fade controls out
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.MouseEvent;

var playBtn:Object = new Object();

playBtn.addEventListener(MouseEvent.MOUSE_OVER, showBtn);
playBtn.addEventListener(MouseEvent.MOUSE_OUT, dimBtn);

function showBtn(e:MouseEvent):void{
	playBtn.alpha = 1;
}

function dimBtn(e:MouseEvent):void{
	playBtn.alpha = 0;
}

Open in new window

Avatar of blue-genie
blue-genie
Flag of South Africa image

are your showBtn etc methods triggered?
why have you made it an Object ?

might be easier if you upload your file
Avatar of Cesar Aracena

ASKER

Dunno if the methods are triggered and I really don't know why an object... didn't know what else to decalre it. That might be the couse but I don't know what else to put in there.

I can't upload the file. It says that there's a file inside the .fla with the extension .xfl. Tried to compress it and got the same result.

How can I send it?

Thanks!!!!!
put a trace inside your method


trace("show btn called");

check your output window - does it display the message when you mouseover the button?

i don't know about the xfl extension thing, try chaning your fla to filename.txt and upload that. (literally just change the extension)
Thanks again blue-genie.

Tried tracing it but the output is white. Maybe I've put it wrong. Here's the file. It turns out that XFL extension is the new FLA extension for CS5. It's just a renamed ZIP containing an XML structure of the project (much like Flex). I guess EE guys will have to include it in the allowed extensions.

I saved it in CS4 FLA and now it's trully an encrypted file (like before).

BTW the middlePlayBtn (the one I'm trying to change on mouse event) has alpha 0. It's the layer 17.

Thanks again.
CUSTOM-BAR-PLAYER-CS4.fla
ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry for the late response. I've got involved in other subject.

Great detailed explanation... worked like a charm ;)

Thanks!