Miyavi Posted February 9, 2014 Share Posted February 9, 2014 Hello! I've just started using Phaser, and I love it. I've tried to load a bitmap font, with no success.When loading the font, JS throws an error on phaser.min.js, saying it can't read the property attributes of "undefined". It seems the error happens on the first line, related to text, when I load the bitmapFont, although according to the examples, I'm doing this correctly. Any help on this? Link to comment Share on other sites More sharing options...
rich Posted February 10, 2014 Share Posted February 10, 2014 Expand out the "Cannot read property 'attributes' of undefined" and see where it's being called. My guess is an error in (or an unrecognised) XML structure. Try loading the bitmap font found in the examples/assets folder. If that works fine with the code you've got, then it narrows it down. Link to comment Share on other sites More sharing options...
Miyavi Posted February 10, 2014 Author Share Posted February 10, 2014 Expand out the "Cannot read property 'attributes' of undefined" and see where it's being called. My guess is an error in (or an unrecognised) XML structure. Try loading the bitmap font found in the examples/assets folder. If that works fine with the code you've got, then it narrows it down.Yeah, indeed I just exported the font with an online tool to a .fnt, and it seems it's working fine now.Any chance CocoonJS recognises this .fnt too, or it has to be .xml? Anyway, I guess it was the format of the XML, as you said. Link to comment Share on other sites More sharing options...
rich Posted February 10, 2014 Share Posted February 10, 2014 I don't really know about Cocoon, sorry. It's likely the fnt file is still just xml under the hood anyway. I seem to remember the issue with Cocoon was that it doesn't have an xml parser built in - do a forum search, this topic has come up a few times and some work-arounds were batted about definitely. Link to comment Share on other sites More sharing options...
Miyavi Posted February 10, 2014 Author Share Posted February 10, 2014 Thanks. I'll definitely do what you suggest. Link to comment Share on other sites More sharing options...
Recommended Posts