Jump to content

Having problems with bitmap font: Cannot read attribute.


Miyavi
 Share

Recommended Posts

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? :)

 

dkiXFhk.png

 

 

Link to comment
Share on other sites

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...