views:

300

answers:

2

Hello, is it possible to use graphics (the numbers 0-9 in one png-file) instead of a Textfield to show the high score of a game to the player? With a TextField it is easy to "refresh" the score but what can I do, if I want to use my png-files for the score? Is there a simple way to do this? How are other flash game designer do it?

My current solution (not tested, just in my head) is, to create 10 bitmaps (numbers from 0-9) or 1 bitmap with all the numbers in it and then convert the current score into a string, split this string and for every digit show the matching bitmap.

Update: or should i try to use filters on the textfield to create a "more beautiful" score?

+1  A: 

The solution you have thought of will work. I used a similar approach a long time ago for a clock count down thing.

Perhaps though maybe just download some nice fonts. http://www.dafont.com/ is great and has some awesome fancy fonts (just check the license usage of a particular font). Then embed them (Alasdair's link).

Also if your after speed then maybe look at http://lab.polygonal.de/2009/12/15/font-rendering-with-the-fp10-drawing-api/. I haven't tried it myself but looks kinda cool.

Allan
+1  A: 

If the digits you want to display exist in some form as a font, then you should almost certainly show them in a text field set to that font - make sure to embed the font in question! The important thing is that there's no reason to use images if the images are coming from a font - just let Flash display the font information.

If however the digits you want to use began life in some other way - if they're hand-drawn, or the come from photos, etc., then the solution you're describing sounds like the right way to go.

fenomas