1 Reply Latest reply on Jun 15, 2010 3:46 PM by chris.campbell

    Loading XML files into flex application

    sensomage5

          Hi Im trying to load an xml file into my app.  The only thing is that its not in the same directory as the application.  I'm very new to flex/air and have read alot of articles but cant seem to figure out what i'm doing wrong.  I have this so far

       

      var data:File = new File("C:/listener/AuditTrail");

      var Data:XML = new XML(data.data);

       

      I dont even know if this is how you are supposed to do it but my ultimate goal is to load the xml and display it on a datagrid.

       

      this is what my xml file looks like

      <data>

      <audit id="7011611">

        <comment>Opened</comment>

        <date>14261</date>

        <time>79367</time>

        <userid>20</userid>

        <employee>JEFF SANCHEZ</employee>

        </audit>

      </data>

       

       

      This is what my datagrid looks like

       

      <mx:AdvancedDataGrid x="11" y="9" id="AuditTrailList" dataProvider="{Data.audit}" designViewDataType="flat" width="866" height="490">

      <mx:columns>

      <mx:AdvancedDataGridColumn headerText="Comments" width="400" dataField="comment"/>

      <mx:AdvancedDataGridColumn headerText="Date" width="70" dataField="date"/>

      <mx:AdvancedDataGridColumn headerText="Time" width="70" dataField="time"/>

      <mx:AdvancedDataGridColumn headerText="ID" width="55" dataField="userid"/>

      <mx:AdvancedDataGridColumn headerText="Employee ID" width="90" dataField="employee"/>

      </mx:columns>

      </mx:AdvancedDataGrid>