MyBall
復習のはじめ
♥0 |
Line 28 |
Modified 2010-12-13 23:19:42 |
MIT License
archived:2017-03-20 16:53:16
ActionScript3 source code
/**
* Copyright t2421 ( http://wonderfl.net/user/t2421 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/xbqk
*/
/*
* BallClass sample
*/
package {
import flash.display.Sprite;
public class Main extends Sprite {
public function Main() {
// write as3 code here..
var ball:Ball = new Ball(20,0xff0000);
this.addChild(ball);
ball.x = Math.random()*stage.stageWidth;
ball.y=Math.random()*stage.stageHeight;
}
}
}
import flash.display.Sprite;
class Ball extends Sprite{
public var vx:Number;
public var vy:Number;
public var radius:Number;
public var color:uint;
public function Ball(radius:Number=10,color:uint=0xff0000){
this.radius = radius;
this.color = color;
initialize();
}
private function initialize():void{
this.graphics.beginFill(color);
this.graphics.drawCircle(0,0,radius);
this.graphics.endFill();
}
}