home *** CD-ROM | disk | FTP | other *** search
- package com.lofiminds.xwung
- {
- import com.lofiminds.gm.GameGraphics;
- import com.lofiminds.gm.GameImage;
- import com.lofiminds.gm.GameObject;
- import com.lofiminds.gm.GameUtil;
- import com.lofiminds.gm.Instances;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- import flash.text.TextFormat;
-
- public class NumberDraw extends GameObject
- {
-
- private static var images:Array = initImages();
-
-
- internal var number:int;
-
- private var scale:Number;
-
- public function NumberDraw()
- {
- super();
- useCustomDraw = true;
- scale = 0.25;
- }
-
- private static function initImages() : Array
- {
- var _loc1_:Array = new Array();
- var _loc2_:TextField = new TextField();
- _loc2_.defaultTextFormat = new TextFormat("_Impact",30,16776960);
- _loc2_.embedFonts = true;
- _loc2_.autoSize = TextFieldAutoSize.LEFT;
- var _loc3_:int = 0;
- while(_loc3_ < 20)
- {
- _loc2_.text = (_loc3_ + 1).toString() + "x";
- _loc1_.push(new GameImage(GameUtil.displayToBitmap(_loc2_)));
- _loc3_++;
- }
- return _loc1_;
- }
-
- override public function update() : void
- {
- if(scale < 1)
- {
- scale += 0.05;
- }
- else if(colorTransform.alphaMultiplier > 0)
- {
- colorTransform.alphaMultiplier -= 0.05;
- }
- else
- {
- Instances.destroy(this);
- }
- }
-
- override public function getClass() : Class
- {
- return NumberDraw;
- }
-
- override public function onCustomDraw(param1:GameGraphics) : Boolean
- {
- var _loc2_:GameImage = null;
- var _loc3_:int = number - 1;
- if(_loc3_ >= images.length)
- {
- _loc3_ = int(images.length - 1);
- }
- _loc2_ = images[_loc3_] as GameImage;
- param1.drawGameImage(_loc2_,0,x,y,0,this.colorTransform,scale);
- return true;
- }
- }
- }
-