Código HTML:
Ver original
Código Javascript:
Ver original
var lienzo, cxt; lienzo = document.getElementById("c"); cxt = lienzo.getContext("2d"); var cargaImagen = function(dondeEstoy) { this.imagen = new Image(); this.imagen.src = dondeEstoy; this.imagen.onload = subeImagen; } cargaImagen.prototype.subeImagen = function () { this.cxt.drawImage(this.imagen,0,0); } var gato = new cargaImagen("imagen.jpg");
No me sale la imagen y me sale en la consola
Código:
He probado al dibujar (drawImage) quitando el this o el cxt , pero no me sale la imagen aun , también he probado con variables globales y nada ... no entiendo porque me pasa esto. Uncaught ReferenceError: subeImagen is not defined