flash on 2011-8-9

by John_Blackburne
♥0 | Line 28 | Modified 2011-08-09 07:14:07 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.text.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var tf:TextField = new TextField();
            addChild(tf);
            
            var statArray:Vector.<UnitStats>  = new Vector.<UnitStats>;
            statArray.push(new UnitStats(1, 7));
            statArray.push(new UnitStats(2, 14));
            
            
            tf.appendText("Unit 0:\n");
            tf.appendText("Health: " + String(statArray[0].Health));
            tf.appendText("Attack: " + String(statArray[0].Attack));
            tf.appendText("\n");
            tf.appendText("Unit 1:\n");
            tf.appendText("Health: " + String(statArray[1].Health));
            tf.appendText("Attack: " + String(statArray[1].Attack));

            
        }
   }
}

class UnitStats {
    var Health:int;
    var Attack:int;
    function UnitStats(_health:int, _attack:int) {
        Health = _health;
        Attack = _attack;
    }
}