flash on 2010-5-4

by hacker_3q88gl5n
♥0 | Line 38 | Modified 2010-05-04 17:44:51 | MIT License
play

ActionScript3 source code

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

package {
	import flash.display.*;
    import flash.events.Event;
	import flash.events.MouseEvent;
	
    public class scrollShape extends Sprite {
        private var shape:Shape;
        private var shape2:Sprite;
        
        public function scrollShape() {
        	init();
        }
        
            private function init():void {
            shape = new Shape();
            addChild(shape);
            
            shape.vy = 2;
            
            shape.y = 465;
            
            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
            
        }
            private function enterFrameHandler(e:Event):void {
            	
            	shape.move();
            	if(shape.y < -465){
                     removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
					removeChild(shape);
					init();
				}


		}
    }
}
import flash.display.Sprite;

class Shape extends Sprite {
       	public var vy:Number;
       	
       	public function Shape() {
       	//graphics.lineStyle (0, 0xFFD700,0.2);	// 線のスタイル指定
        graphics.beginFill (0x00DAF9,0.5);	// 面のスタイル設定
        graphics.drawRect  ( 0, 0, 465, 465);
       	}
        public function move():void {
        	y -= vy;
            
    }  
}

Forked