In the beginning of the function, insert an if statement that checks a flag variable( ex. if (allowFunction==TRUE)...put code in here and end the if statement. Then all you have to do is set the flag to false in the frame you want it to stop running on. Remember, onClipEvent(load) to set the variable to true if you want the function to initialize to run.