使用三角函数让sprite绕圆形移动
private var _square:Sprite;
private var _angle:uint;
public function flashtest()
{
_square = new Sprite();
_square.graphics.lineStyle(0.5);
_square.graphics.drawCircle(0,0,20);
addChild(_square);
_angle = 0;
addEventListener(Event.ENTER_FRAME,move);
}
private function move(event:Event):void
{
var converter:Converter = Unit.DEGREE.getConverterTo(Unit.RADIAN);
var angleRadians:Number = converter.convert(_angle);
_square.x = Math.cos(angleRadians) * 100 + 200;
_square.y = Math.sin(angleRadians) * 100 + 200;
_angle++;
}
private var _angle:uint;
public function flashtest()
{
_square = new Sprite();
_square.graphics.lineStyle(0.5);
_square.graphics.drawCircle(0,0,20);
addChild(_square);
_angle = 0;
addEventListener(Event.ENTER_FRAME,move);
}
private function move(event:Event):void
{
var converter:Converter = Unit.DEGREE.getConverterTo(Unit.RADIAN);
var angleRadians:Number = converter.convert(_angle);
_square.x = Math.cos(angleRadians) * 100 + 200;
_square.y = Math.sin(angleRadians) * 100 + 200;
_angle++;
}