views:

44

answers:

2

I have this class named MovingObject which extends the MovieClip class. This class will be instantianted for several times. Inside this class is a Timer that handles the speed of the objects moving. There is another class called TheStage and this is where I will instantiate MovingObject (s).

public class MovingObject extends MovieClip{
     public var tmr:Timer = new Timer(1);
     public function MovingObject(){
         tmr.addEventListener(TimerEvent.TIMER, Move);
     }
     public function StartMove():void{
         this.tmr.start();
     }
     public function ChangeSpeed(delay:Number):void{
         this.tmr.delay = delay;
     }
     public function Move(evt:TimerEvent):void{
        // some codes to make this.x and this.y change
     }
}



public class TheStage extends MovieClip{
    public var objectArray:Array = [];
    public function TheStage(){
         var x:int =0;
         var mcMoveObject;
         while (x!=10){
              mcMoveObject = new MovingObject();
              mcMoveObject.x += 10;//offset between the objects
              mcMoveObject.y += 10;//offset between the objects
              this.addChild(mcMoveObject);
              objectArray.push(mcMoveObject);
              mcMoveObject.tmr.start();
              x++;
         }
    }
    public function ChangeSpeed(delay:Number):void{//some function to change speed
        for(var chilCnt:int =0;chilCnt

Assuming that the code is working fine (I haven't debugged it), this makes the particles to move all at once. However after several seconds of running it, the particles seem not to be moving in synchronization with each other (because their distances between seem to get nearer). I need some help to make the objects move with their distances each other evened out.

A: 
PatrickS
A: 

heres a great resource on particles

http://sebleedelisle.com/2007/09/as3-particles-1000-extra-free/

I'd recommend taking a look at the code provided

dubbeat