Hi Daniela,
Did you ever solve this? I actually informed you incorrectly: the “onComplete” callback is available from the audio.play() API, not from the audio.fadeOut() API. So, I think you’ll need to play the sound as normal, do a fadeOut (separately), then put the onComplete argument in the play call, like this:
[lua]
local sparkleSound = audio.loadSound( “sparkle.wav” )
local function disposeSound( event )
audio.stop( event.channel )
audio.dispose( event.handle )
sparkleSound = nil
end
local sound = audio.play( sparkleSound, { onComplete=disposeSound } )
audio.fadeOut( { channel=sound, time=1000 } )
[/lua]
Notice that in the fadeOut() call, “channel=sound” is used because “sound” (the local variable set to play the sound) is equal to the channel it plays on… you need that because fadeOut() requires the channel to fade, but you might not know which channel it’s on unless you specify a channel… and since you probably don’t want to do that, “sound” gives you the channel to use with fadeOut().
Hope this helps!
Brent