color

by toburau
♥0 | Line 29 | Modified 2010-08-15 02:46:43 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var textField:TextField;
            textField = new TextField();
            addChild(textField);

            var color:uint = 0xff112233;
            var alpha:uint = color >> 24 & 0xff;
            var red:uint = color >> 16 & 0xff;
            var green:uint = color >> 8 & 0xff;
            var blue:uint = color & 0xff;

            textField.text = color.toString(16) + "\n" +
            alpha.toString(16) + "," +
            red.toString(16) + "," +
            green.toString(16) + "," +
            blue.toString(16);
            
            var box:Sprite = new Sprite();
            addChild(box);
            box.x = stage.stageWidth/2;
            box.y = stage.stageHeight/2;
            box.graphics.beginFill(color);
            box.graphics.drawRect(0,0,100,100);
            box.graphics.endFill();
        }
    }
}