This is because
Canvas.Content
is undefined. There is no such property; and you know it. It should be
canvasContent
you calculated before as
canvas.getContext("2d")
.
Again, your code is pretty bad. You rely on outer context (this very variable), don't use the power of JavaScript objects, don't use encapsulation, don't use closures, don't even use passing of objects in functions. You create objects in outer scope which you never should use after certain phase of code flow, don't limit scope of variables, and so on.
If you are interested, you can look at couple of my JavaScript articles (one of them is also a
Canvas
game) where I discuss some of the problems I mentioned above, and their solutions:
Tetris on Canvas,
JavaScript Calculator.
—SA