Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : stop button sound


Jazzie5
5/22/2004 9:28:02 PM
Hi all,
I have been at this for ages and I am a beginner so I could really do with
some advice!
I have put a sound on a button and I want to know how to tell it to only play
once! I am making a kids program so am aware that kids may soon work out that
pressing the button again will begin the sound again - thus creating an
overlap. OR is it better to make sure that the sound (actually a voice
recording) stops before it plays over the top of another one?
lumeeguvnor
5/22/2004 10:01:47 PM
yoursound= new Sound()
yourSound.attachSound("yourSound");
soundfinished = true;
playBtn.onRelease = function() {
if(soundfinished) {
yoursound.start(0,1)
soundfinished = false;
}
}
yoursound.onSoundComplete = function() {
soundfinished = true;
}
hope this helps
Jazzie5
5/22/2004 11:16:09 PM
Hi,
Thanks for that - I kind of worked it out, cos although I am positive you gave
the correct script, it didnt work!
What I have done is simply gone into sync and put PLAY so that it only plays
if it is not already playing - which is ok cos it allows for it to be repeated
once it has stopped.
That has worked for all my pages but one. The home page, has the SYNC greyed
out, and I am not able to use it. Why is this? I am doing nothing any
differently in there..
lumeeguvnor
5/23/2004 3:37:09 PM
never having used sync i can't help you - though i get the feeling that you
would be better getting to grips with the way i showed you.
you have to import the soundd file into the library and then (use F11) right
slick the sound and click linkage.check the export for actionscript and give it
(or use default) identifier name. this will now mean that the code i gave you
should work - does for me. no need for lots of layers etc - worth giving it a
go just for interests sake - maybe lol
AddThis Social Bookmark Button