all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

Playing a sound once in a site visit


Playing a sound once in a site visit Rosmary6400
2/1/2006 10:30:35 PM
flash actionscript:
Hi,



Is there an option in Flash to only play the sound once, even though the
flash clip is displayed in different pages?



Any help would be appreciated,

Rosmary

Re: Playing a sound once in a site visit kglad
2/2/2006 12:00:00 AM
you could toggle your sound object's start() method to execute only once:

yourS=new Sound();
yourS.attachSound("id");
if(!repeat){
repeat=1;
yourS.start();
}

no matter how many times the above code is executed, your sound will only play
once (unless you reset repeat=0).
Re: Playing a sound once in a site visit Rosmary6400
2/2/2006 7:50:56 AM
Kglad,



Firstly, thank you for reply,



What you said doesn't works on multiple page visit.



I am looking for a solution that works for multiple page visits. That means
if you have the same swf on several pages, the sound get played only the
first page visit, so it won't annoy the user.



Perhaps I should work on cookies or so?



Regards,

Rose





[quoted text, click to view]

Re: Playing a sound once in a site visit gothats
2/2/2006 1:16:00 PM
You should be able to create a Local Shared Object:

sound_so=SharedObject.getLocal("sound");
if(sound_so.data.heardSound){
//Don't Play Sound
}else{
intro_so.data.heardSound=true;
//Play Sound
}
AddThis Social Bookmark Button