Jump to content

BitmapText error


jotaSe
 Share

Recommended Posts

Well, I never got an answer, but I'll try again, I'm having this error

 

Uncaught TypeError: Cannot call method 'split' of undefined (19:27:56:417 | error, javascript)
at b.BitmapText.setStyle (libs/phaser.min.js:4:3571)

 

when I do this

        credits = game.add.bitmapText(game, game.world.width / 2,                10,                'Credits',                { font: '12px font', align: 'center' });

And this is how I call it : game.load.bitmapFont('font', 'font/font.png', 'font/font.xml');

 

Any help?

Link to comment
Share on other sites

Hi Rich, I use the (game) parameter because the docs said that

new BitmapText(game, x, y, text, style)

but avoiding that,

new BitmapText( x, y, text, style)

I get another error

 

Uncaught TypeError: Cannot read property 'size' of undefined (22:30:10:198 | error, javascript)
at b.BitmapText.updateText (libs/phaser.min.js:4:3862)

Link to comment
Share on other sites

You're not creating a new BitmapText though, you're getting one from the GameObjectFactory, so the parameter isn't needed then.

 

Is your font actually called 'font' ? I doubt it personally :) Open the XML file and read what the fonts name really is, because that is what it's expecting in the font object. Here's an example:

<font>    <info face="Desyrel" size="70" bold="0" italic="0" chasrset="" unicode="0" stretchH="100" smooth="1" aa="1" padding="0,0,0,0" spacing="1,1"/>

The "face" node is the actual font name. Note that in Phaser 1.1.5 you can't use fonts with spaces in the name (due to an underlying issue Pixi has with that) but we fixed this in 1.2. In the meantime you can simply edit the xml file and remove any spaces the name might have.

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...