0
votes

i have a data grid in my application and am pulling data from a MYSQL DB using php. is there a way to store all that data into an array and pass it to a function or is it possible to just store the data directly into an array instead of pulling it from the datagrid here is the code

<mx:DataGrid id="dgUserRequest" x="150" y="10" dataProvider="  {userRequest.lastResult.users.user}" editable="false">

    <mx:columns>
        <mx:DataGridColumn headerText="UserID" dataField="userid"/>
        <mx:DataGridColumn headerText="Ip Address" dataField="ip"/>
        <mx:DataGridColumn headerText="latitude" dataField="lat"/>
        <mx:DataGridColumn headerText="longitude" dataField="lng"/>
    </mx:columns>

</mx:DataGrid>
<mx:HTTPService id="userRequest" url="http://localhost/post.php" useProxy="false" method="POST">
    <mx:request xmlns="">
    </mx:request>
    </mx:HTTPService>
2

2 Answers

1
votes

Add a listener to the "result" event of you HTTPService and have the code in the listener function fill a locally stored array.

0
votes

something like this should help

[Bindable]
public var dp:ArrayCollection;



protected function samplePhp_resultHandler(event:ResultEvent):void
{
dp = event.result as ArrayCollection;
}

<mx:HTTPService id="userRequest" url="http://localhost/post.php"                               useProxy="false"         
   method="POST" result="samplePhp_resultHandler">
<mx:request xmlns="">