1 Reply Latest reply on Jul 30, 2008 1:28 PM by post54

    Simple Menu event

      Hi All,

      I'm still new to Flex and AS3, so I hope I'm explaining this in a way that makes sense.

      Right now I've got a simple application that uses a menu to change the dimensions of a RichTextEditor.

      I'm using a Combo Box that lists a bunch of dimensions. Each object also has a width and height value. When a button is clicked, the RTE changes dimensions.

      However, I would like to eliminate the button from the process, and have the dimensions changed when a new object is selected in the ComboBox.

      Being pretty new and sort of fumbling along the way, I'm not sure how the ComboBox works, or if I need to add a listener.

      Here's some of the code in question:

      private function sizePanel(w:uint, h:uint):void {
      rte.width = w;
      rte.height = h;

      <mx:Resize id="resize" />

      <mx:ComboBox id="myComboBoxDropdown" horizontalCenter="-451" verticalCenter="39">
      <mx:Object label="1 1/6' x 3/8'" data="P10" width="77" height="27"/>
      <mx:Object label="2 3/4' x 3/8'" data="P15" width="198" height="27"/>
      <mx:Object label="1 1/2' x 9/16'" data="P20" width="108" height="41"/>
      <mx:Object label="3' x 1 1/2'" data="P60" width="216" height="108"/>
      <mx:Object label="2 3/4' x 1 1/4'" data="P50" width="198" height="90"/>
      <mx:Object label="2 3/8' x 2 3/8'" data="P40" width="171" height="68"/>
      <mx:Object label="1 7/8' x 3/4'" data="P30" width="135" height="54"/>
      <mx:Object label="2 3/8' x 2 3/8'" data="P40" width="171" height="68"/>
      <mx:Object label="1 1/8' x 3/4'" data="P52" width="81" height="54"/>
      <mx:Object label="1 3/4' x 1 3/16'" data="P53" width="126" height="86"/>
      <mx:Object label="1 15/16' x 1 9/16'" data="P54" width="140" height="113"/>
      <mx:Object label="2 3/8' x 1 1/2'" data="P55" width="171" height="108"/>
      <mx:Object label="1 5/8' x 1 5/8'" data="Q43" width="117" height="117"/>
      <mx:Object label="1 1/4' x 1 1/4'" data="Q30" width="90" height="90"/>
      <mx:Object label="1' x 1'" data="Q24" width="72" height="72"/>
      <mx:Object label="5/8' x 5/8'" data="Q17" width="45" height="45"/>

      <mx:Button label="Resize" click="sizePanel(myComboBoxDropdown.selectedItem.width,myComboBoxDropdown.selectedItem.he ight);" enabled="{ buttonsEnabled }" horizontalCenter="49" verticalCenter="268" />

      <mx:RichTextEditor y="10" x="280.5" verticalScrollPolicy="off" width="45" height="45" id="rte" creationComplete="floatControlBar()" cornerRadius="0" headerHeight="0" borderThicknessRight="0" borderThicknessLeft="0" borderThicknessBottom="0" borderThicknessTop="0" resizeEffect="{resize}" horizontalScrollPolicy="off" minHeight="0" minWidth="0">