javascript - Uncaught TypeError: Type error with drawImage -


i new html5 , canvas element , in last few weeks have been trying understand better. anyways getting uncaught typeerror: type error when trying change red square code http://jsfiddle.net/kmhzt/10/ image http://i.imgur.com/k73egsw.png. when try uncaught typeerror: type error. here code have http://jsfiddle.net/ccdfs/.

if need me explain better ask.

you're trying pass url drawimage, can't - need load image element , pass instead, after image has finished loading.

this article has examples of i'm describing.

the code end this:

var img = new image(); img.onload = function() {     context.drawimage(img, 2, 2); } img.src = 'http://i.imgur.com/k73egsw.png'; 

in fact, code when loads , draws tiles.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -