Flash Button Bug

Also known as:

  • cannot click more than once on flash button
  • have to move mouse before you can click a button again
  • v2 components cause weird strange button behavior
  • If you work with V2 components in Flash, this tip will surely help you out some day: when using V2 Components such as a Combobox, you may find your buttons no longer work correctly. Overall, this manifests itself by not being able to click more than once on a button. Before you can once again click on the button, you must first move the mouse again. Especially with navigation buttons, on which you are usually click-click-click-click-click-ing, this is less than optimal.

    This is appearently caused by some components which are not playing nice with a component’s focus. The fix is relatively simple and disturbing at the same time:

    In the onPress handler of such a button, you must include the following:

    Selection.setFocus (this);

    A focus rectangle now appears on every button, and to remove that, you use the following:

    this._focusrect = false;

    It is also possible to apply this to all buttons at once:

    Button.prototype.onPress = function () (
    this._focusrect = false;
    Selection.setFocus (this);
    )

    This will not be an option in most cases however, unless you rigidly commit yourself to overriding only a button’s onRelease handler.

    3 Responses to “Flash Button Bug”

    1. Muzak Says:

      A more elegant solution is to disable and (afterwards) enable the focusManager, which is what messes up focus for non v2 components.

      Here’s an old post on the osflash maiiling list:
      http://osflash.org/pipermail/osflash_osflash.org/2006-April/008682.html
      And more recently:
      http://readlist.com/lists/chattyfig.figleaf.com/flashcoders/5/29106.html

      This is a very old issue though and unfurtunatly never has been fixed.

    2. Sorv Says:

      Tnx Muzak that’s pretty nifty. I’m getting a whole library of these v2 component fixes:).

    3. bhaumik Says:

      thanks, it works perfect in my application….

      keep it up…thanks man..

    Leave a Reply