fireEvent / addEventListener do not work for arbitrary objects?
If I fire my custom event with the following code:
Ti.API.fireEvent('foo', {bar:'baz'});
Then the only way to catch it is to use:
Ti.App.addEventListener('foo', function(e) {
/* this will work */
});
If i try to do this on an arbitrary window or view, the event won't be caught:
view.addEventListener('foo', function(e) {
/* we will never get here */
});
What gives? This kind of defeats the purpose of custom events.
I'm using iPhone SDK 3.1.3, Titanium 1.1.2.
2 Answers
-
you must fire the event in the object that view references
-
Hello , this is My first POST , You must only Fire the event Like this
Ti.App.fireEvent('foo',{data:'data'});