Le Twitch Posted September 16, 2014 Share Posted September 16, 2014 I have a bitmapText that changes colour by changing the bitmapFont. The bitmapFont changes but it doesn't update, so it stays the same colour as before. How do I update the bitmapFont or get around this problem? Link to comment Share on other sites More sharing options...
lewster32 Posted September 16, 2014 Share Posted September 16, 2014 You can force an update with the following:bitmapText.updateText();Though it's often a lot easier to use white text and set a tint the entire bitmapText instance to change the colour. Link to comment Share on other sites More sharing options...
Le Twitch Posted September 16, 2014 Author Share Posted September 16, 2014 You can force an update with the following:bitmapText.updateText();Though it's often a lot easier to use white text and set a tint the entire bitmapText instance to change the colour. I've already been doing that. I found out what the problem was. Is there a setFont for bitmapText or anything similar? That would pretty much fix my issue Link to comment Share on other sites More sharing options...
lewster32 Posted September 16, 2014 Share Posted September 16, 2014 The font property will change the font, same as on the normal Text object. Link to comment Share on other sites More sharing options...
Le Twitch Posted September 16, 2014 Author Share Posted September 16, 2014 The font property will change the font, same as on the normal Text object. So technically i could do "bitmapText.text" instead of "bitmapText.setText" Link to comment Share on other sites More sharing options...
lewster32 Posted September 16, 2014 Share Posted September 16, 2014 Yeah, that works fine in BitmapText. Link to comment Share on other sites More sharing options...
Le Twitch Posted September 16, 2014 Author Share Posted September 16, 2014 Yeah, that works fine in BitmapText. " bitmapText.font = 'font'; " isn't exactly working for me. It's within an onInputDown function. Maybe i'm doing it wrong :S Link to comment Share on other sites More sharing options...
richpixel Posted January 23, 2015 Share Posted January 23, 2015 Yea I've also not been able to get bitmapText.font to work; the original font which I set in the constructor is still used even after this call. I do call 'updateText' so not sure what to do. My alternative is to just use 2 different text fields. Link to comment Share on other sites More sharing options...
Michel (Starnut) Posted February 6, 2015 Share Posted February 6, 2015 Having the exact same problem here. Also took a quick look at the BitmapText source code and saw nothing suspicious. When I log the font field it does return the correct name, though. Maybe a Pixi issue since that's where the rendering happens? Link to comment Share on other sites More sharing options...
Michel (Starnut) Posted February 6, 2015 Share Posted February 6, 2015 Ok, so I dug a bit deeper in the Pixi code and found a quick workaround where you don't set the font but the fontName attribute:myBitmapText.fontName = "myNewFontKey"; // where "myNewFontKey" refers to a font previously loaded into the cacheYou won't find fontName in either documentation since it's only being used as a private field. Essentially, Phaser would also need to set the fontName attribute in the font attributes setter and the problem should be fixed. Update: Filed this issue on GitHub: https://github.com/photonstorm/phaser/issues/1602 Link to comment Share on other sites More sharing options...
Recommended Posts