flash on 2013-9-13

by mutantleg
♥0 | Line 73 | Modified 2013-09-13 23:40:17 | MIT License
play

ActionScript3 source code

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

package {
    
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var a:xActor;
            
            
            vecActor = new Vector.<xActor>(0, false);
            vecSpell = new Vector.<xSpell>(0, false);
            
            a = new xActor();
            a.x = 200;
            a.y = 200;
            addChild(a);
            vecActor.push(a);            
            
        }//ctor
        
        public var vecActor:Vector.<xActor>;
        public var vecSpell:Vector.<xSpell>;
        
        public function onEnter(e:Event):void
        {
            var i:int;
            var num:int;
            var a:xActor;
            var s:xSpell;
            
            num = vecActor.length;
            for (i = 0; i < num; i++)
            {
                a = vecActor[i];
                a.update();
            }//nexti
            
        }//onenter
        
        
    }//classend
}
import flash.text.TextField;

import flash.display.Sprite;

internal class xActor extends Sprite
{
    public var disp:TextField;
    
    public var baseArmor:int = 0;
    public var armor:int = 0;
    
    public var vecSpell:Vector.<xSpell> = new Vector.<xSpell>;
    
    public function xActor()
    {
        disp = new TextField();
        disp.mouseEnabled = false;
        disp.text = "m";
        addChild(disp);
        
        graphics.clear();
        graphics.lineStyle(2, 0);
        graphics.drawCircle(0,0, 8);
    }//ctor
    
    public function update():void {}
    
    public function upValue():void
    {
        armor = baseArmor;
        
        var i:int;
        var num:int;
        var a:xSpell;
        num = vecSpell.length;
        for (i = 0; i < num; i++)
        {
            a = vecSpell[i];
            a.applySpell(this);
        }//nexti
        
        disp.text = ""+num+":"+armor;
    }//upvalue
    
}//xactor

internal class xSpell extends Sprite
{
    public var dead:Boolean = false;;
    public function applySpell(a:xActor):void
    {
       a.armor += 1;     
    }//update
}//xspell