[AS2 - CS5] Code Optimization (Speed issues)

Hi there, I need help in optimizing my code to speed up my flash (game?).

I’m pretty basic with Actionscript and Flash, so I do need a bit of help. If someone could help me with my code, that would be greatly appreciated.

What I am trying to accomplish is to simply, play with little particles, and move them around with gravity. Just something to help amuse people, kill some time, ect. I have it so there is two modes, one is called the “Boom Mode” and the other is called the “Gravity Mode”. The Boom Mode causes all the particles to accelerate towards the mouse position, giving off the apperance of an “Explosion”. The Gravity Mode causes nearby particles to slowly accelerate towards the mouse position as well, to simulate a Gravitaion pull. This is all very basic, it’s definitly not perfect, however, it is again, just a time waster.

My problem is, when you use Gravity Mode, your FPS rate drops drastically (due to the loop used to move particles), only while your mouse button is held down. If someone could please show me the proper way to accomplish what I am doing, that would be great!

Thanks in advance!