Without getting too technical, you don't want to use timers move things.
 You want to use frames instead of timers.  Save yourself some headache and
don't use timers for movement.  (unless you're using them to invalidate
properties and such, but that's a more complex topic)
Now if you want the things to run at different speeds, you could do
something like this:

var ball1Speed:int = 4;
var ball2Speed:int = 2;

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(event:Event):void
{
ball1.x += ball1Speed;
ball2.x += ball2Speed;
}

Also from a resource standpoint, say you have 500 sprites on the screen.
 You don't want 500 timers, that will take too many resources.

HTH,
Nate

On Tue, Dec 16, 2008 at 7:09 AM, Mendelsohn, Michael <
michael.mendels...@fmglobal.com> wrote:

> Hi list...
>
> [finally migrating to AS3]
>
> What would be a good way of going about having many sprites move across
> the screen at different rates?  I have a random number (0-5) that I want
> to use as a coefficient for each sprite's speed.  My thought is to base
> the movement off of Timer events corresponding to each sprite, but is
> there a way of associating a timerEvent to targets?
>
> Thanks,
> - Michael M.
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to