Can anyone tell me if it is possible to put a time delay within a function.

I have a modular movieclip that moves another movieclip towards a target, but gives it that real motion effect.
The script for the modular mc is set over 3 frames

1. sets out the variables
2. has the bones of the action as follows
- finds out distance x and y between where the movieclip to be moved is at an instant and the works out the distance between it and the target x and y. This gives 2 variables that are the x difference and the y difference. These values are then divided by say 10 and then added to the original x and y position of the movieclip.
3. has the gotoAndPlay (2) command

so this modular movieclip controls the action of another.

Can i write this as a function?

i have a function to calculate the x and y difference and add on a fraction of this amount to the movieclip's current coordinates on press of a button. Continued presses move the movieclip towards its target in the desired way but i want all of this to happen on one press only.

i have tried loops to do this but it sends Flash into "i am not going to do as you want me to because i am going to perform so many calculations that i am going to crash" mode!!!!!!!!!!


i kind of new as i was coding that this was going to happen.

would some form of time delay within the function work?
maybe putting in a loop that only runs a certain amount of times as dictated by the initial distances calculated

i did try these but flash calculates too quickly for the eye to see and you have a movieclip instantaneously changing position - not the desired effect

I hope that i have explained myself clearly

Any help would be greatly appreciated

Happy flashing!!!!!!!!!1