PDA

View Full Version : Scope problem in 0.98



logicmedia
28 Oct 2010, 9:43 AM
Hi all,

Some changes have occured in version 0.98 and I now wonder if there somthing to scope I do not understand. I have this test code:



var myApp = Ext.apply(new Ext.util.Observable,{

app: {},

initialize: function() {
console.log('myApp.initialize()');
console.log(this);
return this.initUI();
},

initUI: function() {
console.log('myApp.initUI()');
this.app = new myApp.UI();
return this.app;
}
});

Ext.setup({
icon: 'images/icon.png',
glossOnIcon: false,
tabletStartupScreen: 'images/tablet_startup.png',
onReady: myApp.initialize,
scope: myApp
});


This piece of my have been unchange since I started writing my Touch app using version 0.90. But upgrading to version 0.98 this breaks with the error (in the line "return this.initUI();"):



TypeError: Result of expression 'this.initUI' [undefined] is not a function.


writing the object this to the console shows me that this is now an empty object and not as expected the myApp object. What am I missing - what changed - would love to understand this?

Regards,

Thomas