1 Reply Latest reply on Feb 17, 2009 7:03 AM by Gregory Lafrance

    creating Buttons Dynamically

    Level 1

      Hi All,
      I have a problem with button."How to create the group of buttons(not ButtonBar,ToggleButtonBar) dynamically
      I have one Application under that, i have one component,in that i'm developing the Buttons dynamically.

      while adding the button to container am getting the error

      Here am sending the code,

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%"
      import mx.controls.Button;
      import mx.core.Application;
      import mx.controls.Label;
      import mx.controls.Text;
      import mx.controls.Alert;

      private var arrButtons:Array = new Array("Button1","Button2","Button3","Button4");
      private var button:Button = new Button();

      private function init():void
      for(var i:uint = 0;i<arrButtons.length;i++)
      button.id = arrButtons .toLowerCase();
      button.label = arrButtons
      Alert.show("Button Value: "+button.label+""+button.id);
      <mx:HBox id="btn">


      The above component am adding to the Application using namespaces.

      If u have any ideas in this issue plz tel me...

      Thanks & Regards,