Ok so I\'m creating a game with JavaScript Canvas Elements and such. I\'ve been able to load in TONS of Images, but on a select few, JavaScript replies with Errors such as <
you should wait all elements load,so do like this:
window.onload=function(){
board.drawImage(document.getElementById("player_explode"), this.x, this.y);
}
The problem was the way that I was loading my Images, I should've been doing:
var image = new Image();
image.src = "imagesource.jpg";
But instead I was get the elements by id from the document
page.
Resources:
Explanation on loading images
Explanation on how html loads images