Monday, January 18, 2010

Disabling a Button control for a fixed number of seconds

I was installing a couple of Firefox plug-ins today and noticed the handy delay on a dialog window, which basically forces you to stare at the dialog for 2-3 seconds before you can press “OK”. Although it can be mildly annoying at times, I can see a lot of places where it would be nice to do that in a Flex application, even if it just helps to throttle user submissions (for example, a user couldn’t submit a feedback form for 3-5 seconds after the form was shown).

At any rate, I quickly threw this code together which creates a simple Flex Button control and disables it for 3 seconds. Naturally, I’m sure the code could be improved, or even possibly simplified if you didn’t want/need to update the button label with the counter, but hey…

Full code after the jump.

(more…)

flex disable button

No comments:

Post a Comment

Your comments is appreciate.