tabEnabled

Quick demonstration of a weird bug in Flash that I just re-encountered. If you create a button and do not tabEnable it (myButton_mc.tabEnabled=true), it can become unresponsive for multiple clicks when you don’t move your mouse. Huh? Check out the swf. The two rectangles are buttons. Click them. Then select the combo box. Then, click the “not tab enabled” button multiple times without moving your mouse. Only the first click registers. This always seems to happen with components. And I just had it happen on a more complex swf without components. Setting the button to tabEnabled solves the problem.
Source.

Comments

10 Responses to “tabEnabled”

  1. Douglas McCarroll on June 14th, 2006 6:14 pm

    Seems to work for me, Doug. Firefox 1.5.0.4. Not sure what version of Flash player. (How do I check this?) WinXP.

  2. Doug on June 15th, 2006 5:01 am

    Flash Player version – right click swf “About Flash Player {version}”
    That is strange it works for you. I’ve tried on MIE, Firefox, Players 8 and 9 – and I still only get the initial click registering on the gray rect after choosing something in the combo. If you click the green rect after combo, then multiple gray rect clicks DO work.

  3. Douglas McCarroll on June 15th, 2006 6:49 am

    Okay, now I see it. I must have been moving my mouse a bit.

  4. Viktor on July 26th, 2006 11:37 am

    Great solution! This “bug” had me puzzled for hours.. (I was certain it was probably a glitch in my script or some sort of timing problem).
    After a bit of googling i found i’m not the only one.

    So far I found that this problem only occurs when you use the built in combobox.

  5. Doug on March 16th, 2007 7:39 am

    This solution doesn’t always work. Here’s a better one:


    myButton.onRelease=function(){
    do something....
    Selection.setFocus(this);
    };

  6. travis on April 6th, 2007 6:08 am

    Thanks for posting this! I’ve been searching for a solution to this for a while now and was beginning to think it was somehow just me. :)

  7. travis on April 6th, 2007 6:35 am

    I agree with Doug that the initial solution didn’t always work. BTW, to get rid of the yellow focus borders introduced by setFocus, use _focusrect = false

    myButton.onRelease=function(){
    do something….
    this._focusrect = false;
    Selection.setFocus(this);
    };

  8. Doug on April 6th, 2007 6:39 am

    Thanks for the extra info Travis,

    I actually think the best solution would be

    //don’t need to call the focusrect all the time
    myButton._focusrect = false;
    myButton.onRelease=function(){
    //put the selection at the start of the function, in case the function is supposed to set focus elsewhere
    Selection.setFocus(this);
    do something….

    };

  9. Jim on May 5th, 2007 2:55 pm

    Thanks guys — this thread helped me greatly!

  10. Chad on September 6th, 2007 11:33 am

    More thanks! This has solved a problem bothering us for days.

Leave a Reply