Forked from: _wonder's base diff:33 等速運動 _wonder forked:1favorite:0lines:34license : MIT License modified : 2010-07-03 13:33:36 Embed Tweet // forked from _wonder's base package { import flash.display.Sprite; import flash.events.Event; public class FlashTest extends Sprite { private var ball:Ball; public function FlashTest() { ball = new Ball(20); ball.x = 20; ball.y = stage.stageHeight / 2; addChild( ball ); addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(e:Event):void { if( ball.x < stage.stageWidth - 80 ){ ball.x += 5; } } } } import flash.display.Sprite; class Ball extends Sprite { public var radius:Number; public var color:uint; public function Ball(radius:Number=40, color:uint=0Xff0000){ this.radius = radius; this.color = color; init(); } public function init():void { graphics.beginFill(color); graphics.drawCircle(0, 0, radius); graphics.endFill(); } } Code Fullscreen Preview Fullscreen addEventListener Event.ENTER_FRAME addChild Event uint Sprite Number sort new page view favorite forked pv1173 加速する運動 _wonder forked:2 favorite:0lines:37 (diff:8)