我想你可以听activeitemchange事件,它的处理函数需要参数newValue和Oldvalue - function(this, newValue, oldValue, eOpts) {}
。
埃姆,林不知道你的应用程序的结构,但想法是,你必须李斯特为segmentedbutton
事件activeitemchange
(在控制器,使用的.on()
或任何其他你喜欢的方式),并做一些事情,如:
myButton.on(
'activeitemchange',
function(segmentedbutton, newValue, oldValue) {
// from second button to third, idk you actual button values so its just 2 and 3
if(newValue === 3 && oldValue === 2) {
this.getEditorGeneral().animateActiveItem(0, {type:'slide', direction: 'right'});
// and vice versa
} else if(newValue === 2 && oldValue === 3) {
this.getEditorGeneral().animateActiveItem(0, {type:'slide', direction: 'left'});
}
},
// make sure that you pass proper scope so you can use getEditorGeneral()
this
);
能不能请你应用到我的代码的例子吗? – inane
增加了一个例子来说明我的意思,对不起,如果我错误地理解了触摸特定部分中的问题,我实际上是ExtJS开发人员,而不是触摸。 –
我想myButton会是我分段按钮的引用,对吧? – inane