Go through this sitehttp://www.adobe.com/devnet/flex/quickstart/accessing_xml_data/ The techniques used here will surely make it easy for you,
Regards, Saagar Shetty www.xoriant.com ________________________________ From: Alex Harui <[EMAIL PROTECTED]> To: "[email protected]" <[email protected]> Sent: Wednesday, 10 December, 2008 9:58:24 AM Subject: RE: [flexcoders] Filtering the List Entries depending upon the text entered in text Input box I’d try using XMLListCollection instead of ArrayCollection From:[EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of anuj sharma Sent: Tuesday, December 09, 2008 5:05 PM To: [EMAIL PROTECTED] ups.com Subject: Re: [flexcoders] Filtering the List Entries depending upon the text entered in text Input box Sorry Guys I posted another mail in the group. I thought it was working but it is not going through each node, it is just comparing with the id of the first node of my XML , Below is the code , I apologize for jumping to the conclusion that it is working as initially it seems like. I am doing somethign wrong which makes my code not to loop through each and every node but just matching it with the id of the first node of my XML, Please help me guys to resolve this problem //XML File <devices> <device id="uuid: ac14231535625133346 546"> <attributes> <attribute name="Flex"/> <attribute name="monitor">monitoring</attribute> <attribute name="version">2.0</attribute> <attribute name="location">location</attribute> <attribute name="friendly-name">Camera1</attribute> <attribute name="type">AIR</attribute> </attributes> <schedules/> </device> </devices> /*********** ********* **CODE*** ********* ********* / //This is REST CALL <mx:HTTPService id="devicesXML" method="GET" resultFormat="e4x" result="devicesXMLHandler( event)" showBusyCursor="true"> </mx:HTTPService> //THis makes call to server devicesXML.url="http://"+IP+"/config/devices"; //Thid function is called when values are retreived private function devicesXMLHandler( event:ResultEven t):void { devicesList = event.result. device; //Checks every device for each (var devicesInPool: * in devicesList) { var deviceName:String = devicesInPool. @id; //var label:String= devicesInPool. @id; devicesInList. push(deviceName) ; filteredDevices= new ArrayCollection( devicesInList) ; nvrsInPoolList. dataProvider = filteredDevices; filteredDevices. filterFunction= processFilter; } //This function calls for assigning label for the entries in the List box named nvsInPoolList private function assignFriendlyName( item:Object) :String { //Checks every device for each (var devicesID:* in devicesList) { var deviceName:String = [EMAIL PROTECTED]; //Checks if the current deviceID matches the current item, if so it will search its attributes if(deviceName == item.toString( )) { var devicesText: XMLList = devicesID.child("attributes").child("attribute"); //Checks every attribute tag for each device for each (var attributesFriendlyN ame:* in devicesText) { //Checks if the attribute name is friendly-name if(attributesFriend [EMAIL PROTECTED] == 'friendly-name' ) { var friendlynameText: String = attributesFriendlyN ame.toString( ); return friendlynameText; } } } } return item.toString( ); } //Filtering Data in the Device List private function processFilter( item:Object) :Boolean { return String(item) .toUpperCase( ).indexOf( filterText. toUpperCase( )) >= 0; } //Tracking the typed Camera Name private function doChange():void { if(txtSearch. text!=null) { this.filterText= txtSearch. text; this.filteredDevice s.refresh( ); } } <mx:List id="nvrsInPoolList" allowMultipleSelect ion="true" dragMoveEnabled="true" dragEnabled="true" dropEnabled="true" y="105" x="17" height="462" width="294"/> <mx:TextInput id="txtSearch" x="17" y="75" change="doChange()"/> On Wed, Dec 3, 2008 at 5:31 PM, anuj181 <[EMAIL PROTECTED] com> wrote: Hi All This is somehow regarding the question I have asked few weeks back. Unfortunately I have to stop this task at that time and now need to work on that. My need is that I have some entries in the List as an arrayCollection and there is text input box and I like to have list to filter the data as soon as user starts typing text. I have attached the so far developed code. I need as soon as user types On, the list below should only show first entry which is 'One-Device' . I attached the code but it is not working as I want. This is going to be just my dummy working prototype and once this module has been made working then i am going to merge this module into my Main Project. Also if anyone has any better idea about how to figure this thing out that will be great and instead of arrayColection if we can achieve the same function laity that would be helpful too. Thanks a lot Anuj /*********** *******CODE* ********* ********* ********* / <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe. com/2006/ mxml" layout="absolute" initialize="init()" width="100%" height="100%" horizontalScrollPol icy="off"> <mx:Script> <![CDATA[ import mx.managers. PopUpManager; import mx.effects.DefaultT ileListEffect; import mx.rpc.events. ResultEvent; import mx.controls. Alert; import mx.collections. ArrayCollection; import mx.effects.easing. Elastic; [Bindable] public var ac:ArrayCollection = new ArrayCollection( ["One-Device","Two-Device","Three-Device","Four-Device","Five-Device","Six-Device"]); [Bindable] public var filterText:String = ''; private function doChange():void { this.filterText = txtSearch.text; this.ac.refresh( ); } private function init():void { ac.filterFunction = processFilter; } private function processFilter( item:Object) :Boolean { var result:Boolean= false; if(!DevicesList. labelField. length || DevicesList. labelField. toUpperCase( ).indexOf( this.filterText. toUpperCase( ))>=0) result=true; return result; } private function seeLabel(evt: Event):void { var alrt:Alert=Alert. show(evt. currentTarget. toString( )); } ]]> </mx:Script> <mx:List x="74" y="228" width="229" height="238" dataProvider="{ac}" id="DevicesList"></mx:List> <mx:TextInput x="74" y="198" id="txtSearch" change="doChange()"/> </mx:Application> Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

