|
-
questions about TextEvent
I want the "end result" of a user entering text but the TextEvent fires after each character is entered....is there a way to get it to wait until after the last character is entered? the main problem is that it's always one character behind, so if I've entered:
"Jason"
my last entry reflects:
"Jaso"
obviously that's not what I want!
is there a different property or method that will give me what I want? please advise, thx!
-
How do you mean finished? Does the user have to hit enter afterward, or can they just stop typing, or what?
Here's a technique that I've used before.
Code:
var textTimer:Timer = new Timer(100, 1);
tf.addEventListener(TextEvent.TEXT_INPUT, resetTimer);
textTimer.addEventListener(TimerEvent.TIMER, doText);
function resetTimer(event:TextEvent):void{
textTimer.reset();
textTimer.start();
}
function doText(event:TimerEvent):void{
//do stuff in here.
}
This basically waits until 100ms after the user stops typing to call doText. Depending on your user you may want to raise or lower the time.
-
that's a good technique, thx....I'm surprised there's not more "built-in" ways to support this though!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|