PDA

View Full Version : help with Blink effect



andryi
14 Aug 2009, 6:56 AM
Hi all, I've got a little problem with the Blink efect, so I put 2 timers together, and well each 2500ms the divs etikets change, and each 300ms of the 2500ms executes the effect blink, with a number of repeats of 4 .

Here is the code


var count=0;
var task = {
run: function(){
count=count+1;
Ext.Ajax.request({
url: 'JS/ajax2.jsp?Action=D',
method: 'GET',
success: function ( result, request) {
document.getElementById('div02').innerHTML = document.getElementById('div01').innerHTML
document.getElementById('div01').innerHTML = result.responseText;
//****
var cell1=document.getElementById('div01').innerHTML;
var cell2=document.getElementById('div02').innerHTML;
if(cell1 != cell2 ){
var task2 ={
//el: <span id="div01" style="font-size: 20pt; color: red; font-family: Verdana">&nbsp;</span>,
el: document.getElementById('div01').innerHTML,
run: function(){
if (this.el.isVisible()) {
this.el.setVisibilityMode(Ext.Element.VISIBILITY);
this.el.hide();
} else {
this.el.show();
}
},
interval:300,
repeat:8
}
var runner2 = new Ext.util.TaskRunner();
runner2.start(task2);
}
runner2.StopAll();
//****
},
failure: function ( result, request) {
runner.stopAll();
Ext.MessageBox.alert('Failed', 'Successfully posted form: '+count);
}
});
},
interval: 2500
}
var runner = new Ext.util.TaskRunner();
runner.start(task);
so, Can anybody help me?

Pdta:
here is my div01



autoEl: {html: '<span id="div01" style="font-size: 20pt; color: red; font-family: Verdana">&nbsp;</span>'}

andryi
14 Aug 2009, 10:18 AM
Yes, I did it \:D/

the problem was in



// el: document.getElementById('div01').innerHTML,<--here
run: function(){
el: document.getElementById('div01');<--here
this.el.setVisibilityMode(Ext.Element.VISIBILITY);
if (this.el.isVisible()) <-------------------------------------here
{
Ext.MessageBox.alert('Failed', 'asdasdasdsadadasdasd');
}
so, if I have a div element, I should put some like this;



run: function(){
var el = Ext.get("div01");
this.el.setVisibilityMode(Ext.Element.VISIBILITY);
if (this.el.isVisible())
{
Ext.MessageBox.alert('OK', 'You pass');
}
and show the alert for example:P, If anybody have a problem similar to this, I hope than that help

Animal
14 Aug 2009, 10:40 AM
Well done. A good bit of problem solving.

Perhaps you could add that to the Element class so that you (or others) could use it generally?

Use the Ext.override method to add a method to an existing class.