together with the flag like dee u said of course to really make sure that the process is stopped WHILE the loop is still running.. 'cause if not.. I doubt other events like the click will get processesed..