I've got an algorithm that takes more than several seconds to complete. I'm trying to implement it into a 60fps flash game i'm creating. I am wondering if there is some provision in ActionScript3 to interrupt a computation in order to update the frame and continue the computation afterwards. There probably isn't, so I'm assuming the best method would be to perform the computation for x milliseconds, measure what the frame rate is after, then adjust the time the computation will run for next frame if the frame rate is less than or greater than 60 fps. The drawback with this is that the game won't run at a steady 60fps...
Any other ideas on how to (optimally) perform a large computation in AS3 while maintaining the framerate?
EDIT: For the curious (the calculation, perhaps I should have said algorithm): I'm creating a motion planning library for game AI objects (one use for motion planning). The algorithm is along the lines of a RRT (rapidly exploring random tree) that iterates thousands of times.
Demo link: http://www.swfcabin.com/open/1279044355
Click to motion plan. The circle can "thrust" at a fixed magnitude in any direction.
Also - there is no linear velocity damping (i.e. friction).