Well, I have been doing a lot of small code UI components that are heavily reused. One such component that I made today was a game score ticker. Remember seeing scrolling numbers in lottery or jackpot genre games, where the numbers keeps flipping until a target number? If you have been playing games, you would have noticed similar elements being used score displays on HUDs in games.
I recently created a similar cmoponent which I intent to use in a future game. But since this can be used useful to others I thought I should share the code behind it. I am not making it a perfect component that is completely customizable. But its very easy to change its features. The slider above allows you to check the functioning of this component, but is no way tagged to the slider component (Illustration purpose only).
1. Simple to skin and extend – its just a movieclip that you can explore and edit.
2. There is also a feature where you can make it blink. Blinking is quite an important glitter effect as it can capture the player’s attention. It can be used when user crosses a milestone or a high score.
3. Designed for 4 digit numbers but easy to extend.
Usage is pretty simple –
simply use (MovieClipName).showValue(numberToShow: String, milestone :int);
// First parameter is the number to which the score ticker scrolls to (0 – 9999). Second parameter is the milestone(0-9999).
You can use this component available as a MovieClip in this FLA(Download). You are free to modify / re-use / distribute it. But I ll be glad if you simply drop in a comment here.