Hi,

You can still make a "component" to do this. I would recommend extending the Sprite / MovieClip class as your custom component.

Add a variable called speed and add an "Enter Frame" handler to your code, then in there, work out your next position based on the speed.

It would be a nice way of getting to grips with extending classes and using event listeners too..

   Glen

Mendelsohn, Michael wrote:
In AS2, I would have made a component with a parameter for speed.  I'm
just not sure how to do that in AS3, so I was guessing with a timer, I
could add and event listerner to dispatch an event to the target, but I
guess not.  Thanks!

- MM

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Cor
Sent: Tuesday, December 16, 2008 11:49 AM
To: 'Flash Coders List'
Subject: RE: [Flashcoders] Timer (AS3 newbie question)

Why use a timer?
It is not necessary to do it on exact time because you use a random.
So in this case Event.ENTER_FRAME would do the trick for you.

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to