Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2010 18:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// this little snippet demonstrates how you can handle multiple sounds with just one play button
// switch through the sounds with a simple scroll gesture (by using a ScrollableView
// this code is not complete!! Use it on your own risk. :-)
function createSound(url) {
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, url);
return Titanium.Media.createSound({sound:file});
// called once, loading the first sound to play
var sound = createSound('myfile.mp3');
// var scrollView = Titanium.UI.createScrollableView({});
scrollView.addEventListener('scroll', function(e) {
var page = e.currentPage;
sound = createSound(soundfiles[page][0].file);
// var play = Titanium.UI.createButton({})....
play.addEventListener('click', function()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment