Solved

Flex Timing issue - SetTimeout - preventDefault

Posted on 2011-03-17
2
698 Views
Last Modified: 2012-05-11
On a textInput change event I will execute a search, but I really don't want it after every key press, only after a 2 second gap from when the user stops typing.

I was using SetTimeout, but I realize that it still executes. I thought after every new change event, the previous would be cancelled, but it doesn't.

How do I accomplish this?
0
Comment
Question by:coldchillin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 35159293
I will recommend to declare in your class private variable and use setInterval instead

Example:

private var _textInputInterval:Number;
private var _textInputOutput:String;


private function onChange():void{
  clearInterval(_textInputInterval);
  _textInputOutput = textInput.text;
  _textInputInterval = setInterval(onChange, 2000);
  }
0
 
LVL 1

Author Comment

by:coldchillin
ID: 35183480
I see, the ClearInterval functionality is what I was missing when using SetTimeout.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question