title: Filling Datagrid from remote http service
body: <p>I am trying my first flex application. And have a problems adding data from xml http service to datagid. </p>
  
  <p>My xml file looks like this:</p>
  
  <pre><code>&lt;players&gt;
  
    &lt;player&gt;
      &lt;name&gt;test&lt;/name&gt;
      &lt;status&gt;F&lt;/status&gt;
      &lt;claimed&gt;1&lt;/claimed&gt;
    &lt;/player&gt;
  
    &lt;player&gt;
      &lt;name&gt;meta&lt;/name&gt;
      &lt;status&gt;F&lt;/status&gt;
      &lt;claimed&gt;1&lt;/claimed&gt;
    &lt;/player&gt;
  &lt;/players&gt;
  </code></pre>
  
  <p>First I tried to fill the data in a raw way, so created mxml tag for HTTP service, and added handlers.</p>
  
  <p>But very soon I realized that main application file became unreadable (because of huge amount of code), so I decided to organize it some way.</p>
  
  <p>So decided to replace services with a separate as classes.</p>
  
  <p>My new code looks like this:</p>
  
  <p>MXML:</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
              layout="absolute" creationComplete="main()"  height="756" borderColor="#FFFFFF" width="950" top="10" left="10" horizontalAlign="left" verticalAlign="top" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FCFCFC, #FCFCFC]"&gt;
  
          &lt;mx:Panel width="900" height="727" layout="absolute" title="Игра ГО" horizontalAlign="center" horizontalCenter="0" top="10"&gt;
          &lt;mx:Script&gt;
              &lt;![CDATA[
  
                  import goclient.ListOfPlayers;
                  import goclient.usersList;
                  import goclient.Tester;
                  import mx.controls.Alert;
                  // And makes periodical requests to the server
                  [Bindable]
                  public var users:ListOfPlayers;
                  [Bindable]
                  public var test:Tester; 
  
                  public function main():void{
                      test = new Tester();
                      users = new ListOfPlayers();
  
  
  
                  }           
  
              ]]&gt;
          &lt;/mx:Script&gt;
  
  
              &lt;mx:DataGrid doubleClickEnabled="true" dataProvider="{users.getPlayersList()}" 
                  x="10" y="157" width="860" height="520" id="userList"&gt;
                  &lt;mx:columns&gt;
                      &lt;mx:DataGridColumn dataField="claimed" headerText="Was claimed" width="25"/&gt;
                      &lt;mx:DataGridColumn dataField="name" headerText="Name of the player"  /&gt;
                      &lt;mx:DataGridColumn dataField="status" headerText="Status (Free or Busy)" /&gt;
                  &lt;/mx:columns&gt;
              &lt;/mx:DataGrid&gt;
  </code></pre>
  
  <p>And the service class:</p>
  
  <pre><code>ListOfPlayers.as
  
  package goclient
  {
      import flash.utils.Timer;
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.http.mxml.HTTPService;
  
      public class ListOfPlayers
      {
          public var usersListService:HTTPService;
          private var minTimer:Timer = new Timer(100000, 0);  
          private var playersData:ArrayCollection;    
          private var person:currentPerson; 
  
          public function ListOfPlayers()
          {
              usersListService = new HTTPService();
              usersListService.url = "http://127.0.0.1:8000/go/active/";
              usersListService.addEventListener(ResultEvent.RESULT, resultHandler);
              //Alert.show("Here");
              sendData(); 
              //minTimer.addEventListener(TimerEvent.TIMER, sendData);
              //minTimer.start();
  
          }
  
          public function getResp():String
          {
              return "Resr";
          }
  
          public function resultHandler(event:ResultEvent):void
          {
              //person = new currentPerson(event.result.current.username, event.result.current.img, event.result.current.rank);
              playersData = event.result.players.player;
              Alert.show("resh");
  
          }
          public function sendData():void
          {
              usersListService.send();
          }
  
          public function getPlayersList():ArrayCollection
          {
              Alert.show(playersData.toString());
              return playersData;
          }
  
      }
  }
  </code></pre>
  
  <p>The problem is that nothing is shown in the datagrid</p>
  
  <p>I am just a beginner, so please advice what did I wrong with the class</p>