Hello all, I'm a Flex newbie. I'm working on an application where an end user clicks a button, and when the button is clicked a DB is queried repeatedly until a particular result is returned. When the result is returned the end user gets a confirmation message to tell them that they were successful.
So the code goes like this: private var dBTimer:Timer = new Timer(5000); private function onButtonClick(): void{ dBTimer.addEventListener(TimerEvent.TIMER, timeTick); dBTimer.start(); } public function timeTick(evt:TimerEvent):void { checkStatus(callBackFunction, id); } private function callBackFunction():void { if( status == 'SUCCESS' ) { // cancel the timer dBTimer.stop(); dBTimer.reset(); Alert.show("Succcess string","Info","OK",null,null,INFO_ICON); }else{ //do nothing and the checkStatus //will be called again at next TimerEvent } } So the first time the end user clicks on the button, everything works okay. The DB is queried and when SUCCESS is returned the dBTimer is stopped and reset. The end user gets the Success Alert dialog box and everything is okay. The second time the end user clicks the button, everything happens the same as before, only the dbTimer, despite being stopped doesn't stop working. checkStatus is called over and over again in an infinite loop because the dbTimer never stops. Can anyone suggest anything please ? I am really puzzled by this one. Best Regards, Trish.