Resources/functions.js
//Changed: Function to generate sound for each buttons (MAIN Buttons)
Function to generate sound for each buttons (MAIN Buttons)
Function to generate sound for each buttons ( MAIN Buttons )
function soundPath(path){
	var flagShip = true;
	if(mainButtonState == 1){		
		var audio = Ti.Media.createSound({ url: 'media/emotion/ILike.mp3' });
	} else if (mainButtonState == 2){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IReallyLike.mp3' });
	} else if (mainButtonState == 4){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IDontLike.mp3' });
	} else if (mainButtonState == 5){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IReallyDontLike.mp3' });
	} else if (mainButtonState == 7){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IWant.mp3' });
	} else if (mainButtonState == 8){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IReallyWant.mp3' });
	} else if (mainButtonState == 10){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IDontWant.mp3' });
	} else if (mainButtonState == 11){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IReallyDontWant.mp3' });
	} else if (mainButtonState == 13){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IWantMore.mp3' });
	} else if (mainButtonState == 14){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IWantMuchMore.mp3' });
	} else if (mainButtonState == 16){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IWantLess.mp3' });
	} else if (mainButtonState == 17){
		var audio = Ti.Media.createSound({ url: 'media/emotion/IWantMuchLess.mp3' });
	} else if (mainButtonState == null){
		var audio = Ti.Media.createSound({ url: path });
		flagShip = false;
	}
	if(flagShip){
		audio.addEventListener('complete', function(e){
			var action = Ti.Media.createSound({ url: path });
			action.play();
			action.addEventListener('complete', function(e){
				action = null;
				audio = null;
			});
		});
	}
	mainButtonState = null;
	audio.play(); 
}
function soundPath ( path ) { var flagShip = true ; if ( mainButtonState == 1 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/ILike.mp3' } ) ; } else if ( mainButtonState == 2 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IReallyLike.mp3' } ) ; } else if ( mainButtonState == 4 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IDontLike.mp3' } ) ; } else if ( mainButtonState == 5 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IReallyDontLike.mp3' } ) ; } else if ( mainButtonState == 7 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IWant.mp3' } ) ; } else if ( mainButtonState == 8 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IReallyWant.mp3' } ) ; } else if ( mainButtonState == 10 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IDontWant.mp3' } ) ; } else if ( mainButtonState == 11 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IReallyDontWant.mp3' } ) ; } else if ( mainButtonState == 13 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IWantMore.mp3' } ) ; } else if ( mainButtonState == 14 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IWantMuchMore.mp3' } ) ; } else if ( mainButtonState == 16 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IWantLess.mp3' } ) ; } else if ( mainButtonState == 17 ) { var audio = Ti . Media . createSound ( { url : 'media/emotion/IWantMuchLess.mp3' } ) ; } else if ( mainButtonState == null ) { var audio = Ti . Media . createSound ( { url : path } ) ; flagShip = false ; } if ( flagShip ) { audio . addEventListener ( 'complete' , function ( e ) { var action = Ti . Media . createSound ( { url : path } ) ; action . play ( ) ; action . addEventListener ( 'complete' , function ( e ) { action = null ; audio = null ; } ) ; } ) ; } mainButtonState = null ; audio . play ( ) ; }
Changed: Function to generate sound for each buttons (MAIN Buttons)
Changed : Function to generate sound for each buttons ( MAIN Buttons )
//global mainButtonState; //global actionButtonState; //audio.play(); //Play Audio //Get the audio and play the sound //Reset the Main Button State //Play Audio