View Full Version : Loading Mask set to false event problem in Sencha Touch 2.0.1

30 Oct 2012, 8:08 AM
I use a loading mask to manage the wait time of a PDF preview.

The problem is that the "a" function is not always executed and the loading mask set to false. I guess it is related to the loaded document because for certain documents it works, for others no. Maybe is related to the loading time...

The following is the code that I use:


var html = '<div id="scroller" style="border-style:inset; height: 100%; width: 100%; overflow: auto; text-align:center;">'+
'<iframe id="previframe876" src="'+record.get('contentUrl-PDF')+'" width="100%" height="100%"></iframe>'+


var myiframe = document.getElementById('previframe876');

if (myiframe.attachEvent)
myiframe.attachEvent("onload", a);
} else if (myiframe.addEventListener)
myiframe.addEventListener("load", a, false);

function a() {


Any idea?

1 Nov 2012, 5:49 AM
Did you try moving the a function above where you set listeners?

btw, this doesn't look like it's a ST question with your code.

2 Nov 2012, 5:48 AM
Are you right, it should seem related to JS only, but it's very strange because in the following way it doesn't work again:

var func = function() { console.log("unmask"); Ext.getCmp('documentPanel').setMasked(false);};
if (myiframe.attachEvent) { console.log("first"); myiframe.attachEvent("onload", func );} else if (myiframe.addEventListener) { console.log("second"); myiframe.addEventListener("load", func , false);}

And also with inline function it does not work:

myiframe.addEventListener("load", function() { Ext.getCmp('documentPanel').setMasked(false); }, false);

that's very strange to me.

I use the 2.0.1 touch lib version.

best regards