View Full Version : Stop function from running
Danneman
August 7th, 2003, 08:11 AM
I want to be able to stop a function from running by the press of a button.
Is there such an inbuilt function?
Like "stop function(myFunction);" or something..?
senocular
August 7th, 2003, 08:18 AM
where is it running?
Danneman
August 7th, 2003, 11:17 AM
Its running in a swf that is loaded to the main swf with the loadMovieNum() function.
It can be accessed via _root.myFunction().
λ
August 7th, 2003, 11:28 AM
what does the function do?
if you want to stop it from running always, you can just do this:
myButton.onRelease = function(){
_root.myFunction = null;
//or:
_root.myFunction = function(){
}
}
thoriphes
August 7th, 2003, 11:56 AM
i'd make the function dynamic (as in you assign the function from somewhere else, not on the actual object or whatever), this way, you can delete it when you want....like...
mc.onEnterFrame = function () {
trace("what's the best way to annoy you?");
};
then later on...
delete mc.onEnterFrame;
Danneman
August 8th, 2003, 11:47 AM
Well, I dont want to remove the function, I just want to stop it from executing if its in the middle of execution.
It is a rather large function that takes some time in executing, and it is called every time I change to a new page (browser arrows). So when I update with the next/previous page, the same function is called again, but with slightly different parameters (overloading).
The problem Im having now, though, is that if the function is in the middle of execution, and it is called again at that time (overloaded), the first instance of the function (the one running) will not stop executing, but continue along with the execution of the next function-call.
So what I really want is for the browser-button to FIRST stop the running function, and THEN call the function again (with new parameters).
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.