0 Replies Latest reply on Jul 23, 2008 8:02 PM by gesutton

    Add new button state for programmatic skin?

      Am I on the wrong path here?

      Basically what I am trying to do is create a subclass of the
      mx.controls.Button class, add a ninth button state (say, myState), add
      a case for it in my programmatic skin (myStateSkin), and have the
      button's appearance automatically change when I set its currentState =
      myState, and return to the "upSkin" when I set currentState=null.

      I see a lot of examples of creating a programmatic skin for the eight
      "native" states for the Button class (up, over, down, disabled, etc.),
      but I don't see any information about extending this to include
      additional states. I can't even seem to find where these native eight
      states are defined*; they do not appear in the Button.as file (except
      in a style definition) nor in the UIComponent.as file.

      Can anyone point me to an example of this (in a class definition using
      AS3 and not MXML), or at least clue me in on where the eight native
      states are defined (perhaps I can subclass and override, or copy and
      change the source class). Creating MXML files with states won't help
      since I want this new behavior to be part of my new button class just
      like the existing eight states are.

      *I also find it strange that none of these eight states appear in the
      states collection of a Button instance; that is, when I create my own
      state and push it onto the state stack of my button, it is the only
      state in there. How does a button know it has the other states if they
      are not in the stack and don't seem to be inherited?