I'm trying to make a button have sound when you hover over it, but it isn't working and I don't know why.
I put the sound file above the "Over" frame where I want it to play.
When I click the play button at the bottom of the timeline, the sound works fine but when I go to test the movie the sound never shows up. I thought I might have accidentally cut off the sound or something, so I extended it in the timeline:
but that didn't work either. I have no idea what I'm doing wrong and I'm getting frustrated. The actions that I put in the "Over" frame work fine, but the sound doesnt.
Open your properties panel. Go inside the button and click inside the frame that has the audio. Look at the Sync drop-down. Make sure it's set to event and not Stream. Stream will only play (in this situation) 1 frame of audio. Event will play all the audio.
Event is selected by default so I presume it is selected now but make sure because that would definitely cause the problem and we'll go from there.
Even if it has a long silence in the beginning it will eventually play as long as Event is selected.
From what I see above the silence isn't even a second long (depending on framerate) so you would still hear it.
Are you using any special compression settings in publish settings or any custom compression settings on the imported audios properties in the library?
No such option. You mentioned you can hti the play button and hear audio so I assumed your audio was on anyhow.
Can you try to isolate this? It's so basic it's hard to say what it could be.
Make a new flash doc. Draw one temporary button. Import that audio clip and place it on the timeline in the mouse over frame. Test it.
If that doesn't work, try another audio file.
Make sure your publish settings are set appropriately on audio (defaults to 16khz, yuck).
I was banking on an audio file corruption and you wouldn't hear any audio. At this point can you save your work into a new separate file (just for testing), remove the audio file and re-import it. Then add it back to the button.
My only question on this all is you're using the timeline rather than code so I tend not to suspect code is preventing the default action. Your button DOES show a rollover state correct? You just don't hear audio?
If it wasn't on the timeline it would make me think some code is running the preventDefault() method to stop the event from triggering the button. That or perhaps some code has set the buttons .enabled or .mouseEnabled to false. Or there is text in the button that you haven't disabled the ability to be selected. Text that can be selected can interfere with a buttons rollover so make sure text in or above that button isn't selectable (properties panel to deselect that option or set the .selectable property to false).
Lastly just for debugging perhaps you can set a listener for MOUSE_OVER and make sure it's being fired.
e.g. if the buttons name is myBtn:
myBtn.addEventListener(MouseEvent.MOUSE_OVER, function(e:MouseEvent):void { trace("Mouse Over!"); }, false, 0, true);
Then when you roll over the button you should see "Mouse Over!" in your trace window.
North America
Europe, Middle East and Africa
Asia Pacific