flash on 2009-9-19

by hacker_alqfxqhw
♥0 | Line 37 | Modified 2009-09-19 15:28:31 | MIT License
play

ActionScript3 source code

/**
 * Copyright hacker_alqfxqhw ( http://wonderfl.net/user/hacker_alqfxqhw )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/pdF9
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var unit:Unit = new Unit();
            unit.x = 100;
            unit.y = 100;
            this.addChild(unit);
        }
    }
}

import flash.display.*;
import flash.text.*;

class Unit extends Sprite {
  public static var SIZE:int = 32;

  public function Unit() {
    super();
    paint();
  }

  protected function paint():void {
    graphics.beginFill(0xCCFF00);
    graphics.drawRect(0, 0, SIZE, SIZE);
  }

  public function menu(item):void {

  }
}

class UnitMenuItem {
  public var str:String = "";
  public function UnitMenuItem(str:String) {
    this.str = str;
  }

  public function get textField():TextField {
    var tx:TextField = new TextField();
    tx.text = str;
    return tx;
  }
}