Link to home
Start Free TrialLog in
Avatar of needanansweryesterday

asked on

click button sound

Hi all.

I have a "enter site" link set up on an index page. After the SWF finishes playing, I need the visitor to hear a click sound when they click the enter link.

Right now the enter link is controlled by AS3 in the SWF. I cannot figure out how to add the sound. If I just just the properties palette, it causes the whole SWF to loop. If I add some AS3 I found to the final frame of the "enter site" link movie it also causes the SWF to loop.

Can someone help me figure out exactly how to write the AS3 and where to put it in the Flash file?

Flash file is attached.

Thanks in advance.
Avatar of blue-genie
Flag of South Africa image

you can either put the sound in the library or load it at runtime. if it's a small button click sound the library option should work.

import it, give it a class identifier i.e in this case Stop. stick the code in your current click handler.

var snd:Stop= new Stop();

yourexitbtnName.addEventListener (MouseEvent.CLICK, soundbutton_Handler);

function soundbutton_Handler (e:MouseEvent):void {;
Avatar of needanansweryesterday


blue-genie - I appreciate your help.

My problem is I don't know squat about AS and am not a developer, thus, I don't really know what to do with your sage advice.

To make matters worse, I don't even know that I can frame an intelligent question on this subject, but...

the code you gave me - I'm guessing - should either go on the last frame of the "enterlink" movie instance, or on the last frame of the animation, right?

As of now, the last frame of the animation has this code:

function mouseclicked(e:MouseEvent):void{
    navigateToURL(new URLRequest(""));
function hilite(e:Event):void{
function lolite(e:Event):void{

eb.buttonMode = true;
eb.mouseChildren = false;
eb.addEventListener("rollOver", hilite);
eb.addEventListener("rollOut", lolite);
eb.addEventListener("click", mouseclicked);

The long and short of it is, I don't know how to integrate your code into what is already existing....

Are we having fun yet?
Avatar of blue-genie
Flag of South Africa image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial