flash on 2015-6-24

by asou_jp
♥0 | Line 33 | Modified 2015-06-24 13:20:33 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.text.TextField;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            // write as3 code here..
            
            var bmd:BitmapData = new BitmapData(10,10,true);
            
            
            bmd.fillRect(bmd.rect, 0xFFFFFFFF);
            var histogram:Vector.<Vector.<Number>> = bmd.histogram();
            
            var tf:TextField = new TextField();
            tf.autoSize = "left";
            tf.appendText(String(histogram[0][255]));
            tf.appendText("\n");
            tf.appendText(String(histogram[1][255]));
            tf.appendText("\n");
            tf.appendText(String(histogram[2][255]));
            tf.appendText("\n");
            tf.appendText(String(histogram[3][255]));
            tf.appendText("\n");
            stage.addChild(tf);
            
            
            bmd.fillRect(bmd.rect, 0x00000000);
            var histogram:Vector.<Vector.<Number>> = bmd.histogram();
            
            tf.appendText(String(histogram[0][0]));
            tf.appendText("\n");
            tf.appendText(String(histogram[1][0]));
            tf.appendText("\n");
            tf.appendText(String(histogram[2][0]));
            tf.appendText("\n");
            tf.appendText(String(histogram[3][0]));
            tf.appendText("\n");
            
        }
    }
}