var l = false;
var l2 = false;
var imm = new Image();
imm.src = \"b.png\";
imm.onload = function(){
l = true;
}
var imm2 = new Image();
imm2.src = \"c.png\";
imm
If these are the only 2 times throughout your entire script that l
and l2
are set, then you can check after setting the values.
var l = false;
var l2 = false;
var imm = new Image();
imm.src = "b.png";
imm.onload = function(){
l = true;
if (l && l2) {
myFunc();
}
}
var imm2 = new Image();
imm2.src = "c.png";
imm2.onload = function(){
l2 = true;
if (l && l2) {
myFunc();
}
}
function myFunc(){
//do stuff
}