Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to test if sound is playing

Status
Not open for further replies.

dipita

Programmer
Apr 7, 2005
22
US
Hi,
I'm doing a simple intro flash with a button to start/stop sound. Initially when the flash loads, I play the sound. I want to know if there's a way to test if the sound is already playing before stopping/starting it (depending on which button the user clicks?) That is, if the sound is already playing and the user clicks "start", I don't want it to start again, so is there a way to check if it's playing?

Thanks!
 
You can always set a variable (like _global.isPlaying...), and condition your start button to act only if the variable is not true...

Kenny uses this somewhat in his fabulous soundObject tutorial...


Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Hi oldnewbie,
I actually figured that there was a sound.position method that I could use to track if the position of the file is greater than 1,then it's started; then save the position for later if they decide to turn it on- it works alright but your idea is great too.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top