views:

47

answers:

2

I tried

btn.click();

And the error message is 'Cannot call property click in object ti.modules.titanium.ui.ButtonProxy@44f61. It is not a function, it is "object"'

A: 
btn.addEventListener('click',function() {
    Titanium.API.info('Button Clicked');

});
Nithin
Thanks for the response. I have the event listener wired up as you did, and it fires when I click the button. I want to execute the event handler from code.
David Silva Smith
+2  A: 
btn.fireEvent('click');

this should work

Aaron Saunders
Yes, that's right. We call fireEvent instead of listening eventListener.
anticafe