Reputation: 3125
I have this code in version sencha touch 1.1, how to make it works in Version 2?. "load" is not working
Html:
<img src="" id="previewImage"/>
Code:
this.domImage=Ext.get("previewImage");
this.domImage.on("load",function(){
debugger; // not working
a.sizePhotoInContainer();
a.resizePhoto()
});
on() was deprecated: http://docs.sencha.com/touch/2-0/#!/api/Ext.EventManager-method-on
Thanks!
Upvotes: 1
Views: 1913
Reputation: 46425
load
is not a property for image
component in ST2. It's an event
that will be fired when image is loaded.
So, you need to listen
for load
event of image
component in Sencha Touch 2.
Do it like this,
var img = Ext.create('Ext.Img', {
src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png',
height: 64,
width: 64,
listeners : {
load : function {
// ....
// ....
// ....
}
}
});
Upvotes: 1
Reputation: 23262
I don't have much experience with Sencha, but I think it would be something like this...
// create image
var img = Ext.create('Ext.Img', {
src: 'http://www.sencha.com/example.png'
});
// callback on load
img.load = function() {
}
Or
var img = Ext.create('Ext.Img', {
src: 'http://www.sencha.com/example.png',
load : function() { }
});
Upvotes: 0