flash on 2011-11-20

by 3f5
♥0 | Line 20 | Modified 2011-11-20 10:20:54 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var bitmapData:BitmapData;
        public function FlashTest() {
            bitmapData = new BitmapData(465, 465);
            
            addChild(new Bitmap(bitmapData));

            lineTo(0, 0, 465, 465);
        }
        
        public function lineTo(fromX:int, fromY:int, toX:int, toY:int):void {
            while (fromX < toX && fromY < toY) {
                fromX += (toX - fromX) * 0.5;
                fromY += (toY - fromY) * 0.5;
                
                bitmapData.setPixel(fromX, fromY, 0x000000);
            }

        }

    }
}