Exactly when i want it to

Ok, so…
How do I have something happen at the exact time (milliseconds) i want it to?**

I need to have something done when exactly X milliseconds have lapsed since whatever.

** Also, Why does this happen: (related to the initial question in an effort to create and accurate, simple drum machine)**

A movieclip (call it Line here) closes in on an other one (call it Box). As they collide, a sound plays (let’s say a hihat sound)

FPS is 10 for the swf. The Line advances at 1px/frame.

You set up Boxes at 10px spaces and have the Line run them over at 1px/frame. The sound it creates is as follows:


Why can this be? I guess it has something to do with the nature of flash/AS but really don’t know. Someone enlighten me? Feels a bit weird that this can happen, since everything’s moving at a very constant speed. There’s nothing that should be able to vary here. Yet it does.

Annoys me a bit to tell the truth, something that should be very straightforwarded turns out to cause random fluctuations. Why oh why? How can a ******* computer not be able to replicate the exact same results time after frickin’ time if nothing changes in the setting it works on?


Having the Boxes monitor when the X co-ordinates of both the box and the line match is also not accurate. Why? Would seem even more straightforwarded than the previous two methods and thus more eligible as to work properly.

Maybe flash just ain’t cut out for this? Seems kinda unlikely.