【发布时间】:2012-11-17 13:03:56
【问题描述】:
具体来说,我需要 Python 等价物:
Ti.API.fireEvent('custom_event', { row_id : 10; });
我试过这个:
Ti.API.fireEvent('custom_event', { 'row_id' : 10 })
但是,我无法在侦听器端检索参数值。这一定是 dict-KObject 转换的问题,我无法弄清楚。
【问题讨论】:
具体来说,我需要 Python 等价物:
Ti.API.fireEvent('custom_event', { row_id : 10; });
我试过这个:
Ti.API.fireEvent('custom_event', { 'row_id' : 10 })
但是,我无法在侦听器端检索参数值。这一定是 dict-KObject 转换的问题,我无法弄清楚。
【问题讨论】:
我认为你可以这样做:
// listen:
Ti.API.addEventListener("sEventName",function(e){
var sValue = Ti.API.get("keyName");
Ti.API.info(sValue);
});
// fire:
Ti.API.set("keyName","value goes here");
Ti.API.fireEvent("sEventName");
【讨论】:
应该是 Ti.App.fireEvent() 而不是 Ti.API.fireEvent()
【讨论】: