4 Replies Latest reply on Jan 9, 2008 9:13 AM by Newsgroup_User

    OOP: Focus problems with custom form items

    Webmaster_Pete Level 1
      Hey All,

      So I have this huge AS 2.0 framework for a large ecomm flash site. The part that I am working on revolves around custom form item elements. ( i.e. checkbox, radiobuttons, radiobuttongroups, dropdown boxes e.g. ). Note: these are not being used as flash components nor is any element in this project a compiled/flash component. They are all pure OOP .as classes with the graphic icons being the only thing in the fla library. ( So an automatic FocusManager shouldn't kick in as far as I know. )

      A lot of you probably know the issue I'm about to describe. We click on a custom movieClip formitem (i.e. checkbox) we can use the spacebar to check/uncheck it ( as per our coding ). However once we roll away from the item's boundingbox we loose focus of the item. It also won't throw a killFocus call when this happens ( This is the biggest problem ).

      Is there anyway to disable this automated focus handling that AS 2.0 seems to have??? I've set focusEnabled to false in all three basic type prototypes. ( I've listed at the end the prototypes I've set to false in order to accomplish this. )

      I've been through these forums and seen its something that can't be worked around but can it (lol). So the only solution I can think of is to create a custom FocusManager. I'd really like to not have to do something like this since I can see it getting nasty especially since I'd have to drop control of the focus if the person had a textbox selected and also it would have to pass certain key events to the focused item ( i.e. spacebar for check box and arrow keys to to radio button groups ).

      Damn you AS 2.0

      MovieClip.prototype.tabEnabled = false;
      Button.prototype.tabEnabled = false;
      TextField.prototype.tabEnabled = false;

      MovieClip.prototype.focusEnabled = false;
      Button.prototype.focusEnabled = false;
      TextField.prototype.focusEnabled = false;

      MovieClip.prototype.focusEnabled = false;
      Button.prototype.focusEnabled = false;
      TextField.prototype.focusEnabled = false;

      MovieClip.prototype.tabChildren = false;
      Button.prototype.tabChildren = false;
      TextField.prototype.tabChildren = false;

      MovieClip.prototype._focusrect = false;
      Button.prototype._focusrect = false;
      TextField.prototype._focusrect = false;