我试图每秒以顺时针方向移动蓝色圆圈(bcircle)内的红色圆圈(bcircle.rcircle)。我尝试在计时器事件处理程序(redClockwise)中更改红色圆圈(bcircle.rcircle)的 x 和 y 坐标。我将不胜感激这方面的任何帮助。谢谢。
我当前的代码如下..
package
{
import flash.display.*;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class blueCircles extends MovieClip
{
public var bcircle:MovieClip = new MovieClip();
public var rcircle:MovieClip = new MovieClip();
private var timer:Timer = new Timer(1000,10);
public function blueCircles()
{
createCircles();
timer.start();
timer.addEventListener(TimerEvent.TIMER, redClockwise);
}
private function createCircles():void
{
for (var i:Number=0; i<=9; i++)
{
var bcircle:MovieClip = new MovieClip();
var bxpos:int = 20;
var bypos:int = 20;
bcircle.graphics.beginFill(0x0033CC);
bcircle.graphics.drawCircle(bxpos,bypos,15);
bcircle.graphics.endFill();
bcircle.y = (30 + 10) * i;
addChild(bcircle);
//var rcircle:MovieClip = new MovieClip();
bcircle.rcircle = new Shape();
var rxpos:int = 15;
var rypos:int = 25;
bcircle.rcircle.graphics.beginFill(0xFF0000);
bcircle.rcircle.graphics.drawCircle(rxpos,rypos,5);
bcircle.rcircle.graphics.endFill();
rcircle.y = (30 + 10) * i;
bcircle.addChild(bcircle.rcircle);
}
}
public function redClockwise(e:TimerEvent):void
{
trace("Call");
//bcircle.rcircle.rotation += 50;
bcircle.rcircle.x += 50 * Math.PI/180;
bcircle.rcircle.y += 50 * Math.PI/180;
//rcircle.rotation = 50;
}
}
}