Solved

Flex Timing issue - SetTimeout - preventDefault

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now