Hi,
I am trying to create an interface that can record vibration on touch of a control, for example, till the user presses the control, its a vibrate period, when he releases the control, its a silence period till he presses again. I am thinking of using a variable to increment it when the user presses the control and pushing it to an array for Ti.Media.vibrate. This can record the vibration, but the silence period should start when the user releases the control, untill it presses it again. Can anybody please suggest how can I fire a functionality when the user releases the control? Any other suggestion for the intended implementation would be great as well. Below is the code to give an indication of my logic.
Thanks!
var vibrateRecording = [];
var vibrateDuration = 0;
var silentDuration = 0;
var record = Ti.UI.createButton({ bottom:'0' });
record.addEventListener('click', function() {
Ti.Media.vibrate(0,10); //just to give the user a the sense of vibration on click
vibrateDuration++;
vibrateRecording.push(vibrateDuration); //this vibrateRecording can be passed
// to Ti.Media.vibrate after saving the
// recording.
});