You will need to do what you're doing now, but just move that initialize
listener to the controller:
Ext.define('StromRechner.controller.Settings', {
extend: 'Ext.app.Controller',
config: {
refs: {
houseImage: 'image' //edited - '#houseImage' was not working
},
control: {
'houseImage':{
initialize: 'initImage'
}
}
},
initImage: function(img){
img.element.on({
swipe: function(e, node, options){
if(e.direction == "left") {
alert("Hey! I swipe left");
} else if(e.direction == "right"){
alert("Hey! I swipe right");
}
}
});
}
});