flash as3.0 动态画曲线
stage.frameRate=31;
var qx:Sprite=new Sprite();
var yuan:Sprite=new Sprite();
var i:uint = 50;
stage.addEventListener(Event.ENTER_FRAME,hua);
function hua(event:Event):void {
i++;
var PosY:Number = Math.sin(i/20) * 30;
//画曲线
qx.graphics.beginFill(0xFF0000);
qx.graphics.drawCircle(i, 150 + PosY, 1);
addChild(qx);
//画动态圆
yuan.graphics.clear();
yuan.graphics.beginFill(0x000000);
yuan.graphics.drawCircle(i, 150 + PosY, 4);
addChild(yuan);
if (i>=500) {
stage.removeEventListener(Event.ENTER_FRAME,hua);
}
}
效果
补充:flash教程,As3.0