title: Datagrid based on input from textbox and combobox
body: <p>Part of the program I am creating includes having a drop down menu where the user can select a type of load, before inputting the position of the load. The load and position would then appear in a datagrid and as many as the user pleases can be added. </p>
  
  <p>I am not very sure where I went wrong but this is my code:</p>
  
  <pre><code>function loadlist():void{
  combobox1.addItem ( { label: "Choose a Load" } );
  combobox1.addItem ( { label: "Point Load" } );
  combobox1.addItem ( { label: "Bending Moment" } );
  combobox1.addItem ( { label: "Uniformly Distributed Load" } );
  combobox1.addItem ( { label: "Varying Distributed Load" } );
  combobox1.addItem ( { label: "Nonlinear Distributed Load" } );
  }
  
  function loadbuttonclick (event:MouseEvent):void{
  combobox1.removeAll();
  loadlist();
  trace("load");
  
  //datagrid
  var myTextFormat: TextFormat = new TextFormat();
  myTextFormat.font = "Comic Sans MS";
  
  var datagrid:DataGrid = new DataGrid;
  datagrid.columns = ["Type of Load", "Position of Load"];
  datagrid.resizableColumns = true;
  datagrid.setRendererStyle("textFormat", myTextFormat);
  datagrid.addItem(Load type: "combobox1.selectedItem.label", Load position: "loadposition.text");
  
  
  addChild(datagrid);
  
  datagrid.addEventListener(Event.CHANGE, gridItemClick);
  
  function gridItemClick (event:Event):void{
  trace("The Selected Load is " + combobox1.selectedItem.label);
  }
  }
  }
  </code></pre>