Solved

Flex Timing issue - SetTimeout - preventDefault

Posted on 2011-03-17
2
691 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reloading a complete air application 13 449
transparent background on a spark spinnerlist? 6 999
Flex 4.6 -- not able to Enable text fields 2 522
doubt future Flex 4 438
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…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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