Newbie alert! So, I have my datagrid that I found somewhere on the internet (I can't remember where....I put this project on hold for a couple of months). The default data that populates it is with U.S. states. I'd now like to populate that with data from my server. I've managed to put the HTTPService in and the functions that grab the data. Now, I'm stuck. I feel like I've just been experimenting and getting nowhere. How do I get rid of the states and put in my data? Thanks in advance!
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ private function init():void{ stuff.send(); } private function httpFaultHandler(event:FaultEvent):void{ Alert.show("We are conducting maintenance on our servers. Please check back later.","Error"); } import mx.rpc.events.FaultEvent; private function httpResultHandler(event:ResultEvent):void{ thisisit = event.result.entry.rooms; } import mx.rpc.events.ResultEvent; [Bindable] private var thisisit; import com.boyzoid.PagableArrayCollection.PagableArrayCollection import mx.controls.Alert; [Bindable] public var myTest:PagableArrayCollection = new PagableArrayCollection( [{label:"AK", dataa:"Alaska"}, {label:"AL", dataa:"Alabama"}, {label:"AR", dataa:"Arkansas"}, {label:"AZ", dataa:"Arizona"}, {label:"CA", dataa:"California"}, ]); public function initApp():void{ myTest.filterFunction = filterStates; } public function ItemsPerPage(value:Number):void{ myTest.itemsPerPage = value as Number; } private function filterStates(item:Object):Boolean{ if(item.dataa.toLowerCase().search(search.text.toLowerCase()) == -1){ return false } return true } ]]> </mx:Script> <mx:HTTPService id="stuff" url="http://localhost/test.php" fault="httpFaultHandler(event)" result="httpResultHandler(event)"/> <mx:VBox y="10" width="50%" horizontalCenter="0" horizontalAlign="center"> <mx:HBox width="100%" horizontalAlign="center"> <mx:Button label="<<" click="myTest.pageDown()"/> <mx:Button label=">>" click="myTest.pageUp()"/> </mx:HBox> <mx:Text x="532" y="28" text="Page {myTest.currentPage} of {myTest.pages}"/> <mx:HBox width="100%" horizontalAlign="center"> <mx:TextInput text="20" id="items" textAlign="center" change="ItemsPerPage(int(items.text))" restrict="0-9" width="40" /> <mx:Text text="items per page"/> </mx:HBox> <mx:HBox> <mx:FormItem label="Search State Name"> <mx:TextInput id="search" change="{myTest.refresh()}" /> </mx:FormItem> </mx:HBox> </mx:VBox> <mx:DataGrid dataProvider="{myTest}" width="200" horizontalCenter="0" bottom="15" top="100"/> </mx:Application>