stopping a script without quiting,

in a program i’m working on, a button in one window hides it’s window and shows another then starts a very long loop in the background, the problem is i need to have a button in the front window that can then halt or pause the background loop.
is this possible?

See this thread: http://bbs.applescript.net/viewtopic.php?t=5711

Jon