Skip to main content
January 25, 2008
Question

adding sound to a button-please help

  • January 25, 2008
  • 2 replies
  • 272 views
I have added sound to a button "over" state, but I would like to start only if mouse pointer stays over button more than 1 sec. I got this code from clbeech, but I don't quite get it.

This is what I did:
1. I made button play-put it to stage and gave it instance name "play"
2. I imported sound to library-selected it clicked properties-linkage-and gave indentifier "sound"
3. I made new layer named actionscript and entered the clbeech's code
4. In
btnsound.attachSound('btnsound_id');
I replaced btnsound_id with sound

5. in
my_btn.onRollOver = function() {
I replaced my_btn with play (also I put play.onRollOut )

When I publish it, there are no errors shown, but sound doesn't load, nothing happens.
What am I missing.
Thanks,
Sasa
This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
January 29, 2008
there's no play() method for the sound class. that should be start().
kglad
Community Expert
Community Expert
January 25, 2008
do you have a sound in your library with that linkage id? (ie, you right click on the library sound, click linkage and sound is in the identifier box?)
January 28, 2008
Yes,
I have sound music.mp3 in my library and I gave it linkage id=sound.
Nothing happens when I pass with pointer over the button.
If somebody can help me with this please.
Thanks. Sasha