flash on 2010-2-26

by aass
♥0 | Line 28 | Modified 2010-02-26 14:46:08 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.display.BlendMode;
    import caurina.transitions.Tweener;
    import caurina.transitions.properties.ColorShortcuts;
    
    [SWF(width=465,height=465,frameRate=30,backgroundColor=0xffffff)]
    
    public class FlashTest extends Sprite {
    		public static const BALL_RADIUS:uint = 10;
    		public static const BALL_MARGIN:uint = 10;
    		
        public function FlashTest() {
            // write as3 code here..
            //ColorShortcutsを有効化
            ColorShortcuts.init();
            
            //ballの横と横の個数を計算
            var l:uint = Math.ceil(stage.stageWidth / (BALL_RADIUS * 2 + BALL_MARGIN));
            var m:uint = Math.ceil(stage.stageHeight /(BALL_RADIUS * 2 + BALL_MARGIN));
            
            for(var i:int; i<l; i++){
         		for(var j:int; j<m; j++){
         			//ballを作成
         			var ball:Sprite = new Sprite();
         			ball.x = i * (BALL_RADIUS * 2 + BALL_MARGIN) + (BALL_RADIUS + BALL_MARGIN);
         			ball.y = i * (BALL_RADIUS * 2 + BALL_MARGIN) + (BALL_RADIUS + BALL_MARGIN);
         			ball.alpha = 0.5;
         			ball.blendMode = BlendMode.HARDLIGHT;
         			ball.graphics.beginFill(0xffffff);
         			ball.graphics.drawCircle(0,0,BALL_RADIUS);
         			ball.graphics.endFill
        			}
            }
        }
    }
}