flash on 2010-1-14

by zahir
♥0 | Line 48 | Modified 2010-01-14 16:29:43 | MIT License
play

ActionScript3 source code

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


package {
	import top.Test;
    import flash.display.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var t1:Test = new Test( this );
            var t2:Test = new Test( this );
            
            
            var g:Graphics = t1.g;
            g.beginFill(0xFF0000);
            g.drawRect(0,0,50,50);
            g.endFill;
            
            
            g = t2.g;
            g.beginFill(0xFF0000);
            g.drawRect(0,0,50,50);
            g.endFill;
            
            t1.x = t1.y = t2.y = 10;
            t2.x = t1.x + t1.width + 10;
        }
    }
}

import flash.display.*;
class Test{
	private var s:Shape = new Shape();
	public function Test(parent:DisplayObjectContainer){
		parent.addChild(s);
	}
	public function get g():Graphics{
		return s.graphics;
	}
	public function get x():int{
		return s.x;
	}
	public function set x( value:int ):void{
		s.x = value;
	}
	public function get y():int{
		return s.y;
	}
	public function set y( value:int ):void{
		s.y = value;
	}
	public function get height():int{
		return s.height;
	}
	public function get width():int{
		return s.width;
	}
}