flash on 2010-10-1

by zahir
♥0 | Line 37 | Modified 2010-10-01 18:33:59 | 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/eqWT
 */

package {
    import flash.geom.Rectangle;
    import flash.text.TextField;
    import flash.filters.GlowFilter;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        
        private var g:Graphics;
        public function FlashTest() {
            // write as3 code here..
            var cont:Sprite = new Sprite();
            var s:Shape = new Shape();
            g = s.graphics;
            
            g.lineStyle(1, 0x00FF00);
            g.beginFill(0xFF0000,0.0);
            g.drawRect(0,0, 100, 100);
            g.endFill();
            
            s.filters = [ new GlowFilter(0, 1, 8,8,32) ];
            cont.addChild(s);
            addChild( cont );
            s.x = s.y = 180;
            
            var t:TextField = new TextField();
            t.width = t.height = 465;
            var r:Rectangle;
            
            t.text = "getBounds\n";
            r = getBounds(s);
            t.appendText( "" + r.width );
            
            t.appendText("\n\n getRect\n");
            r = getRect(s);
            t.appendText( "" + r.width );
            
            t.appendText("\n\n container rect\n");
            r = getBounds( cont );
            t.appendText("" + r.width);
            
            addChild(t);
            
        }
    }
}