6
I started developing a HTML5 game using the library Easeljs. When creating a class called Bot
, which will contain the code of the robot used in the game, got the following error:
Uncaught TypeError: Cannot read property 'getContext' of undefined
As I understand it, this error occurs when Javascript runs before the canvas initialized. But that doesn’t seem to be the case (the class instance Bot
is created only in the call of handleImageLoad
, after the image of Sprite sheet be loaded into the call from init
performed at the event onLoad
of the HTML body).
Debugging, it seems to me that the mistake occurs when trying to create the SpriteSheet
(within the call of initialize
). I put the code in Jsfiddle. Can anyone identify where I’m going wrong?
Man, without a shadow of a doubt, that was it (what a silly mistake I was making, huh?). Thank you! :)
– Luiz Vieira
These things happen... Sometimes we need a rubber duck.
– Jordão
Hehe Well around. Thanks again! []s
– Luiz Vieira