I'm creating some simple 2D Sounds in my "onInit":
- Code: Select all
-- Create Sounds
sound.setLooped ( 0 )
sound.setVolume ( 1 )
sound.setSoundFile ( "success.ogg" )
sound.setIsStreamed ( 0 )
sndSuccess = sound.createSound ( )
sound.setLooped ( 0 )
sound.setVolume ( 1 )
sound.setSoundFile ( "failure.ogg" )
sound.setIsStreamed ( 0 )
sndFailure = sound.createSound ( )
sound.setLooped ( 0 )
sound.setVolume ( 1 )
sound.setSoundFile ( "selected.ogg" )
sound.setIsStreamed ( 0 )
sndSelect = sound.createSound ( )
and then playing them in "onMouseDown" - depending on certain logic:
- Code: Select all
if iMatch == 1 then
sound.play2DSound ( sndSelect )
else
sound.play2DSound ( sndFailure )
end
The first time each sound plays it works fine, but doesn't seem to play after that? I've tried using
- Code: Select all
if sound.isPlaying ( sndFailure ) == 1 then
sound.stopSound ( sndFailure )
end
but that doesn't seem to make any difference.
Does anyone have any idea what I'm doing wrong (it's been a while since I played with sounds, so please be gentle!)?
Thanks in advance
Shando