I have my canvas saved as an object but it won't let me add an eventListener because it creates this error:
Object #<Object> has no method 'addEventListener'
This is how i create the canvas:
var i = 1;
document.getElementById("G").innerHTML += '<canvas id="layer'+i+'" class="c" style="z-index:'+i+';"></canvas>';
temp = document.getElementById('layer'+i);
objname = 'canvas'+i;
canvas[objname] = new Object();
canvas[objname].ctx = temp.getContext("2d");
Then i do:
canvas.canvas1.addEventListener("mousedown", fnc_test, false);
Any ideas why this is not allowed, or where I am going wrong??