tags:

views:

23

answers:

1

Hello, I have a button that plays a sound and i want to prevent users from tapping the button multiple times and having the sound play more than once. I need a way to check if a sound is already being played when the button is pressed and if so, don't play it.

I suppose i could start a time when the button is pushed that is the exact length of the audio file, but that doesn't seem like an efficient way to do it, especially with multiple audio files.

Thanks, Chase

A: 

It's a hack, but you could give the button a boolean flag that flips to "playing" when the user clicks it and flips back when the clip finishes. That means you'd need to add some sort of "flipButton" line to the end of whatever plays your clip. I've never done iPhone development, though, so no promises if that'll work.

perimosocordiae