Don't bother with binding in this case, just assign the result to the ArrayCollection (or XMLListCollection) in the result handler.
Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of tweakfreak33 Sent: Monday, April 16, 2007 5:03 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Binding ArrayCollection to HTTPService method="POST" Hi All, Firstly apologies for posting all this code! I have the following app that works fine, it's displays data from a mysql db in a datagrid, and also allows a user to insert a new record in the db... #########################<START SNIP>########################## <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " xmlns="*" layout="absolute" backgroundGradientColors="[#0080ff,#80ffff]" creationComplete="send_data()"> <!-- This is the Script to SetUp Functions--> <mx:Script> <![CDATA[ private function youveClicked():void { mx.controls.Alert.show('You Clicked!!!'); } private function send_data():void { staffcodeRequest.send(); } ]]> </mx:Script> <!-- This is the HTTPService--> <mx:HTTPService id="staffcodeRequest" url="http://192.168.0.84/amfphp/services/staffcode.php <http://192.168.0.84/amfphp/services/staffcode.php> " useProxy="false" method="POST"> <mx:request xmlns=""> <firstname>{firstname.text}</firstname><surname>{surname.text}</surname> <staffcode>{staffcode.text}</staffcode><emailaddress>{emailaddress.text} </emailaddress><department>{department.text}</department> </mx:request> </mx:HTTPService> ###########################<END SNIP>########################## I'm thinking of Binding the the xml formated results into an arrayCollection & then use the filterFunction to allow a user to filter the data (is this possible?). (Below is some code that I found in a thread & am using to work from as an example) #########################<START SNIP>########################## <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="vertical" creationComplete="initData()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var dataList:ArrayCollection ; private function initData():void{ dataList= new ArrayCollection([ {name:"school A", city:"Dartford"}, {name:"school B", city:"Pomona "}, {name:"School C", city:"Phillipsburg"} ]) } private function filterDemo():void{ dataList.filterFunction = searchDemo; dataList.refresh(); } private function searchDemo(item:Object):Boolean{ var isMatch:Boolean = false if(item.name.toLowerCase().search(search.text.toLowerCase()) != -1){ isMatch = true } return isMatch; } private function clearSearch():void{ dataList.filterFunction = null; dataList.refresh(); search.text = ''; } ]]> </mx:Script> ###########################<END SNIP>########################## If it is possible, I need some help in integrating the following code, (I've tried but keep getting {1151: A conflict exists with definition staffcodeRequest in namespace internal.}) #########################<START SNIP>########################## <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " xmlns="*" layout="absolute" backgroundGradientColors="[#0080ff,#80ffff]" creationComplete="send_data()"> <!-- This is the Script to SetUp Functions--> <mx:Script> <![CDATA[ private function youveClicked():void { mx.controls.Alert.show('You Clicked!!!'); } private function send_data():void { staffcodeRequest.send(); } <!--Can I just Bind the arrayCollection here--> import mx.collections.ArrayCollection; [Bindable] private var staffcodeRequest:ArrayCollection; <!--This part I also need to change as my data is returned on the fly from a mysql lookup rather than a static xml file--> private function filterDemo():void{ staffcodeRequest.filterFunction = searchDemo; staffcodeRequest.refresh(); } private function searchDemo(item:Object):Boolean{ var isMatch:Boolean = false if(item.staffcode.toLowerCase().search(search.text.toLowerCase()) != -1){ isMatch = true} return isMatch; } private function clearSearch():void{ staffcodeRequest.filterFunction = null; staffcodeRequest.refresh(); search.text = ''; } ]]> </mx:Script> <!-- This is the HTTPService--> <mx:HTTPService id="staffcodeRequest" url="http://192.168.0.84/amfphp/services/staffcode.php <http://192.168.0.84/amfphp/services/staffcode.php> " useProxy="false" method="POST"> <mx:request xmlns=""> <firstname>{firstname.text}</firstname><surname>{surname.text}</surname> <staffcode>{staffcode.text}</staffcode><emailaddress>{emailaddress.text} </emailaddress><department>{department.text}</department> </mx:request> </mx:HTTPService> ###########################<END SNIP>########################## What I am strugling with is BINDING the returned xml formated results to an arrayCollection, so that I can assign a filterFunction. Help would be grate ;-) TIA Danny