How to use audio event completed?

The description for audio event.completed doesn’t make sense to me. How do you use this?

I’d like to call on a function when a sound completes. [import]uid: 98652 topic_id: 17640 reply_id: 317640[/import]

See how in the example here it states onComplete = 0 ?

http://developer.anscamobile.com/reference/index/audioplay

Well, say you have a function called printSomething and you want it to happen when the audio is done, you would say;

[lua]onComplete = printSomething[/lua]

That calls the function.

Eg;
[lua]backgroundMusicChannel = audio.play( backgroundMusic, { channel=1, loops=-1, fadein=5000, onComplete=printSomething } )[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 17640 reply_id: 67124[/import]

Thanks for the reply, this works well.

I was confused by the entry for audio.complete [import]uid: 98652 topic_id: 17640 reply_id: 67159[/import]

Happy to help :slight_smile:

Peach [import]uid: 52491 topic_id: 17640 reply_id: 67230[/import]