Trying to increment counter after five seconds if there is text in a window
I am trying to increment a counter by one digit if a window (called searchItem_txt) contains text for more than five seconds. The code below activates the counter after five seconds but it keeps on incrementing until the count has reached 63. Any suggestions for fixing this code would be much appreciated. Thanks.
var SearchItemTimer:Timer = new Timer(5000, 1);
SearchItemTimer.addEventListener(TimerEvent.TIMER, CountOneClearWindow);
function CountOneClearWindow(event:TimerEvent):void
{
counter = counter + 1;
customerCount_txt.text = String(counter);
searchItem_txt.text = ("");
}
if (searchItem_txt.text != "")
{
SearchItemTimer.start();
}