Following the tutorial on the introduction PDF,
I can't get bitmapfont's autoScale feature to work.
Here's my code:
public class StarlingTest extends Sprite { [Embed(source="../assets/petita_0.png")] private static const BitmapChars:Class; [Embed(source="../assets/petita.fnt", mimeType="application/octet-stream")] private static const PetitaXML:Class; public function StarlingTest() { addEventListener(Event.ADDED_TO_STAGE, init); } public function init(e:Event):void { var bitmap:Bitmap = new BitmapChars(); var texture:Texture = Texture.fromBitmap(bitmap); var xml:XML = XML(new PetitaXML()); TextField.registerBitmapFont(new BitmapFont(texture, xml)); var bmpFontTF:TextField = new TextField( 500, 500, "Here is some text, using an embedded font!", "PetitaMedium", 12); bmpFontTF.fontSize = BitmapFont.NATIVE_SIZE; bmpFontTF.autoScale = true; addChild(bmpFontTF); } }
I think BitmapFont.NATIVE_SIZE and autoScale conflicts with each other...
If I don't activate autoScale and just use BitmapFont.NATIVE_SIZE, everything works fine. However, I want to be able to make my font smaller, or use the autoScale feature.
so I try removing this line: bmpFontTF.fontSize = BitmapFont.NATIVE_SIZE;
If I do that, nothing renders at all on the screen.
Any ideas?