Hi all,
 
The next code is used to find a reference to a layer and after hitting some button a gif is added as a child to the layer.
 

function headCommander() {
theImage = DynImage.getImage("../images/question.gif");
this.img = new DynImage(theImage); 
 
this.qmarklayer = DynAPI.document.getAll()['qmark'];
this.qmarklayer.setVisible(true);
this.qmarklayer.setBgColor('#FBF9DB');
 
this.searchMode = false;
 
//methods
this.changeMode = changeMode;
}
 
function changeMode() {
 if (this.searchMode==false) {
  this.qmarklayer.addChild(this.img);
  this.searchMode = true;
 } else {
  this.qmarklayer.removeChild(this.img);
  this.searchMode = false;
 }
}
 
 
The reason I post this cry for help is that 50% of the time I load my page, the reference is not found.
The error message is sometimes:DynImage is not found and sometimes the error is: this.qmarklayer is null or not an object
 
I think it has to do with the time to load the image and/or the time to find the div reference in my page. In other words some sort of timeout issue.
 
Did anybody else of you have these troubles also?
I am very curious as I am not a javascript guru.
Thanks,
Ton.
 
 
 
 

Reply via email to