ToggleButtonBar w/ Separators, Multiline & Solid Color State Attributes

ToggleButtonBar w/ Separators, Multiline & Solid Color State Attributes

This started off last night as an extension of the ToggleButtonBar so that I could easily skin it with solid background colors for the button states as I was tired of creating custom skins for this. By the time I finished I ended up hacking some multiline and button separator features into it too.

  • The separators width, height and color can be set via ToggleButtonBar mxml attributes.
  • Multiline can be set via the “multiline” mxml attribute (true/false).  If you set this to true, you may want to remove the height to allow it to autosize and prevent clipping.
  • This was really designed for solid colored states (up, over, down, selectedUp, selectedOver, selectedDown, disabled) but I’m sure it can be used for custom skins just as easy.  Take a look at the example source to see the actual attribute names for setting these.

Note: I haven’t tested this yet but the separators may not remove themselves if you dynamically remove buttons.  I think it was the removeChild function in one of the Super classes that was set to private so I left it as is for now (it’s working for the project I need it for at the moment).   If anyone improves on this (trust me there’s plenty of room), please shoot it back my way and I’ll update the example.  …Thanks, -Rob

Example
Source