0 Replies Latest reply on May 8, 2008 10:22 PM by Jaguar280

    popup datagrid not populating data from xml

      hey guys,

      im having trouble creating a datagrid within a popup. i created the datagrid on a normal panel and everything worked fine. then i tried to recreate it within a popup and now im having trouble getting the xml data onto the datagrid. i think the problem is that the xml is not a variable within the function but ive tried multiple methods and i have not gotten it to work.

      whenever it runs it just says TypeError: Error #1009: Cannot access a property or method of a null object reference. yet when i remove the dg.dataProvider = list.michigan.venue; line the datagrid works but there is no data obviously... how do i define the xml dataprovider within the function??? also, i need the name of the state to be dynamic... how could i make it so that the datagrid uses the selected state within the xml file? i imagine i would be passing a variable through the function that would be called when i select the path within the xml. THX GUYS!

      <name>Location Name</name>
      <address>This is the address</address>
      <name>Location Name</name>
      <address>This is the address</address>

      here is the code im using to get the xml file...

      <mx:XML id="list"/>

      <mx:HTTPService id="getXML" url="VenueList/list.xml" resultFormat="e4x" result="list = XML(event.result);"/>

      here is the code for the popup

      import mx.controls.dataGridClasses.DataGridColumn;
      import mx.collections.ArrayCollection;
      import mx.containers.Panel;
      import mx.controls.Button;
      import mx.controls.DataGrid;
      import mx.controls.dataGridClasses.DataGridColumn
      import mx.managers.PopUpManager;

      private var panel:Panel;

      private function init():void {
      var dg:DataGrid = new DataGrid();
      var dgc:Array = dg.columns;
      var d1:DataGridColumn = new DataGridColumn;
      var d2:DataGridColumn = new DataGridColumn;
      var d3:DataGridColumn = new DataGridColumn;
      var d4:DataGridColumn = new DataGridColumn;
      var d5:DataGridColumn = new DataGridColumn;
      var d6:DataGridColumn = new DataGridColumn;

      dg.width = 638
      dg.height = 163
      dg.dataProvider = list.michigan.venue;

      d1.width = 150;
      d1.headerText = "Venue Name";
      d1.dataField = "list.michigan.venue.name";
      d2.width = 150;
      d2.headerText = "Address";
      d2.dataField = "address";
      d3.width = 100;
      d3.headerText = "City";
      d3.dataField = "city";
      d4.width = 50;
      d4.headerText = "State";
      d4.dataField = "state";
      d5.width = 50;
      d5.headerText = "Zip";
      d5.dataField = "zip";
      d6.width = 100;
      d6.headerText = "Phone";
      d6.dataField = "phone";

      dg.columns = dgc;

      panel = new Panel();
      panel.title = "Here are our venues:";
      panel.width = 658;
      panel.height = 203;

      private function closePopUp(evt:MouseEvent):void {

      private function createPopUp():void {
      PopUpManager.addPopUp(panel, this, true);