3 Replies Latest reply on Oct 19, 2009 10:55 AM by kabalweg

    No data from httpservice in datagrid


      I wrote some code after first lesson from tutorial 'flex in one week' by Adobe. I want to populate instance of DataGrid with data from xml file. I use HTTPService class to do this. Here is my code:





      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                import mx.rpc.events.FaultEvent;
                import mx.controls.Alert;
                import mx.events.DataGridEvent;
                private var peopleList:ArrayCollection;
                private function init():void{
                private function httpResultHandler(event:ResultEvent):void{
                     this.peopleList = event.result.people.person;
                private function httpFaultHandler(event:FaultEvent):void{
                     Alert.show("There was a problem","Error");
           <mx:HTTPService id="srv" url="assets/people.xml" result="httpResultHandler(event)" fault="httpFaultHandler(event)"/>
           <mx:DataGrid x="0" y="0" width="100%" height="100%" id="dg" dataProvider="{peopleList}">
                     <mx:DataGridColumn headerText="Name" dataField="name"/>
                     <mx:DataGridColumn headerText="Surname" dataField="surname"/>
                     <mx:DataGridColumn headerText="Age" dataField="age"/>

      Can someone take a look at my code and try to help me ?


      The result of it in my browser is alert which appears during carrying out the function httpFaultHandler, but I don't know why this function is executed..


      Thanks in advance