Events
Events are the messages that are created through the use of your app. Smartphones and tablets are full of gadgets and things to touch and drag, and so there are the following events happening all the time:
Buttons pressed
Touch gestures
View scrolling
Location changes
You need a way to handle these inputs and react to them. This is done with events.
Events are very common in Titanium; you will include them in probably every app that you write. They are hard to avoid and have appeared in examples from earlier chapters. In Chapter 2, How to Make an Interface, where an iOS button was put on the taskbar, we saw the following code:
function rightButton(win){ if (!isAndroid()) { var right=Ti.UI.createButton({ systemButton:Ti.UI.iPhone.SystemButton.INFO_LIGHT }); right.addEventListener('click',function() { alert('button clicked!'); }); win.setRightNavButton(right); } }
And in Chapter 3, How to Design Titanium Apps, we saw the following...