WitheringTreant Posted November 8, 2014 Share Posted November 8, 2014 Hello, I've recently tried to update phaser from 2.0.7. But using any version of newer phaser starts giving me this one type of errors (this example is from phaser 2.1.3). Uncaught TypeError: Cannot read property 'frame' of undefined VM35 phaser.js:25568 Phaser.Input.hitTest VM35 phaser.js:25568Phaser.InputHandler.checkPointerDown VM35 phaser.js:30622Phaser.Pointer.processInteractiveObjects VM35 phaser.js:27864Phaser.Pointer.update VM35 phaser.js:27712Phaser.Input.update VM35 phaser.js:25236Phaser.Game.update VM35 phaser.js:24526Phaser.RequestAnimationFrame.updateRAF VM35 phaser.js:42978_onLoop The common thing with all of the errors is that they refer to this line (25568 in 2.1.3) in the hitTest function: var width = displayObject.texture.frame.width; Nothing in the developer tools has referred to anything outside of phaser.js, which is why I have no idea how I would adjust my code to fix this. I also noticed this change in 2.1.0 (next release I found from 2.07) which had this following change: Resolves issue with pixel perfect click / over detection on Sprites that used trimmed image atlases for animations or frames > 0.I'm wondering if this change could have somehow caused the problems i am having. It seems to involve something like hitTest does and frames. So, I know that this is probably a tricky thing to help someone with. I don't know what to do, and I would prefer not to be stuck in phaser 2.0.7 forever with my gamecode.Any suggestions about what might cause this conflict are welcome. I would share code but as the errors refer to nothing in my code, I don't know what to share. Link to comment Share on other sites More sharing options...
rich Posted November 8, 2014 Share Posted November 8, 2014 Post the code you're trying to run that causes this, it's much easier to help that way. If the code is too long, start cutting it down until you've isolated it as best as possible. Link to comment Share on other sites More sharing options...
InsaneHero Posted November 8, 2014 Share Posted November 8, 2014 Just a quick guess here (I've seen similar messages previously but perhaps not exactly the same)... Check the latest animations and sprites you have added to your game for errors in the graphic files (preview them all from the desktop and make sure they look ok) and in the way you've referred to them in the preloader (sprite sheet sizes and number of frames, xml files match atlases, etc etc). 'undefined' mostly happens when something has failed at a previous stage, and the error stack you have listed is a regular phaser update that happens to expect "displayObject.texture.frame" to be valid. This sort of tracking could be caught automatically at the first point of failure, but that would involve a LOT of extra checks which would reduce performance considerably. That said, there might be an argument in favour of a dedicated Phaser branch with all of the checks (a "debug" build)... if anyone can be found to maintain it! Link to comment Share on other sites More sharing options...
WitheringTreant Posted November 11, 2014 Author Share Posted November 11, 2014 Hey, thanks for your replies. I'll try them out as soon as I have some free time. Link to comment Share on other sites More sharing options...
WitheringTreant Posted December 14, 2014 Author Share Posted December 14, 2014 Hey, i finally figured the problem out. When creating buttons: new Button(game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame) I had values on overFrame, outFrame, downFrame which shouldn't have been there. I guess they came when I copied button creation from phaser examples. They caused no problems prior to 2.0.7 but conflicted after updating. So the problem is solved now. Link to comment Share on other sites More sharing options...
Recommended Posts