Difference between revisions of "SoundChannel Event.COMPLETE"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
=== Example === | === Example === | ||
− | < | + | <syntaxhighlight lang="lua"> |
-- load a music file | -- load a music file | ||
local snd = Sound.new("DST-Psykick.mp3") | local snd = Sound.new("DST-Psykick.mp3") | ||
Line 19: | Line 19: | ||
-- add the event listener that is firing when the sound finishes playing | -- add the event listener that is firing when the sound finishes playing | ||
chan:addEventListener(Event.COMPLETE,onSoundComplete) | chan:addEventListener(Event.COMPLETE,onSoundComplete) | ||
− | </ | + | </syntaxhighlight> |
{{SoundChannel}} | {{SoundChannel}} |
Latest revision as of 14:33, 13 July 2023
Available since: Gideros 2011.6
Value: complete
Defined by: SoundChannel
Description
This event is dispatched when the sound channel has finished playing.
Example
-- load a music file
local snd = Sound.new("DST-Psykick.mp3")
-- start playing the music file and store the channel
local chan = snd:play()
-- define the Event.COMPLETE function that is called when the sound
-- finishes playing
function onSoundComplete(event)
print ("Sound complete")
end
-- add the event listener that is firing when the sound finishes playing
chan:addEventListener(Event.COMPLETE,onSoundComplete)
- SoundChannel:getPitch
- SoundChannel:getPosition
- SoundChannel:getStreamId
- SoundChannel:getVolume
- SoundChannel:isLooping
- SoundChannel:isPaused
- SoundChannel:isPlaying
- SoundChannel:setEffect
- SoundChannel:setLooping
- SoundChannel:setPaused
- SoundChannel:setPitch
- SoundChannel:setPosition
- SoundChannel:setVolume
- SoundChannel:setWorldPosition
- SoundChannel:stop