weratius Posted May 22, 2015 Share Posted May 22, 2015 Hello, guys! I get an error in my console " Uncaught TypeError: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The provided value is not of type '(HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap)' " I have a sprite (Planet), there is a callback function on it's clicking. This callback function create a tileSprite and some sprites with images and adds in a group all of them. When I use destroy() for this group everything is alright BUT when I'm trying to click on that Planet sprite again I get this error I think that there is a rendering problem and also I know that in standart canvas methods I need to create image via new Image() for the rendering So, what should I do? Thank you in advance A screenshot is attached Link to comment Share on other sites More sharing options...
weratius Posted May 24, 2015 Author Share Posted May 24, 2015 Is here anybody? Link to comment Share on other sites More sharing options...
Maxime Posted May 24, 2015 Share Posted May 24, 2015 I think you'll need to give us a little more code than this.It could really help to see some code. Link to comment Share on other sites More sharing options...
weratius Posted May 28, 2015 Author Share Posted May 28, 2015 I think you'll need to give us a little more code than this.It could really help to see some code.I just have a group of sprites which is on over main one, but when I destroy them I have such an error Link to comment Share on other sites More sharing options...
drhayes Posted June 1, 2015 Share Posted June 1, 2015 You have to unsubscribe the click handler from the sprite when you destroy it. If you don't, the sprite no longer exists and thus has no texture to pass to the createPattern method when the sprite gets clicked on again. Link to comment Share on other sites More sharing options...
Recommended Posts