6 Replies Latest reply on Jun 5, 2009 7:57 AM by Handycam

    Multi-line toggle button bar labels?

    Handycam Level 1

      I am trying to do a grid of buttons where only one button in a row can be "pressed".  Seems, based on suggestions here as well, the easiest way is one togglebuttonbar per row of a grid.


      Anyway, I need to have taller buttons with a few lines of text in each label (button).  Think of a table where the cells are selectable.


      I found a way to extend a simple button's label to make it multi-line, but not sure on how to do this for a togglebuttonbar:



      package tools


      import flash.text.TextFieldAutoSize;

      import mx.controls.Button;

      import mx.core.mx_internal;

      use namespace mx_internal;

      public class MultilineButton extends Button {

      public function MultilineButton()


      override protected function createChildren():void



      textField.multiline = true;

      textField.wordWrap = true;

      textField.autoSize = TextFieldAutoSize.LEFT;


      override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {

      super.updateDisplayList(unscaledWidth, unscaledHeight);

      textField.y = (this.height-textField.height)>>1;





      And then I call it with <t:MultilineButton label="four score and seven years ago" width="150" height="150" textAlign="left"/>



      Should I just use this single button in a Repeater?  Or is there a way to work with the togglebuttonbar?