showmehow
12-18-2008, 01:06 AM
Hi,
New to this forum and relatively new to flex3 and actionscipt.
Need help finding out why I am having issues with importing an xml file with httpservice into a XMLListCollection.
All I am looking to do is load an xml file into a XMLListCollection with httpservice and then show it in the text area as a list of children within the XMLListCollection.
Tried many methods and cannot get any to work for me??
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" ">
<mx:Script><![CDATA[
import mx.collections.XMLListCollection;
import mx.utils.ObjectProxy;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
[Bindable]
public var datalist:XMLListCollection;
public function doSend(search:String):void
{
xmlFromDatabase.url = "./includes/flexsearchxml.php?search="+search;
xmlFromDatabase.send();
}
//THIS IS WHERE I CANNOT GET THE HTTPSERVICE REQUEST RESULT STORED IN DATALIST AS AN XMLLISTCOLLECTION< THEN SHOW THE RESULT IN TEST(TEXTAREA)
private function resultHandler(event:ResultEvent):void{
//datalist.source = new XMLList(event.result.data.row);
//datalist = new XMLListCollection(event.result.data.row);
var xmlList:XMLList = new XMLList(event.result.data.row);
datalist.source = xmlList;
//datalist = new XMLListCollection(xmlList);
//datalist = _xlcCatalog;
test.text=datalist.children();
//datalist = event.result.data.row;
//test.text=event.result.toLocaleString();
}
]]>
</mx:Script>
<mx:HTTPService url="./includes/flexsearchxml.php" id="xmlFromDatabase" showBusyCursor="true" result="resultHandler(event)" method="GET" resultFormat="e4x"/>
<mx:TextInput id="textinput" width="478" textAlign="center" keyUp="doSend(textinput.text)"/>
<mx:TextArea id="test" width="300" height="100">
</mx:TextArea>
</mx:Application>
This code comes from a larger application and I have removed surplus un-needed code, when I run this same code using a variable _xlcCatalog, which is an XMLListCollection, everything works fine, and the resulting XMLList from _xlcCatalog is listed in the text area on keyup within the textinput field.
Any assistance is appreciated, thanks
Showmehow
New to this forum and relatively new to flex3 and actionscipt.
Need help finding out why I am having issues with importing an xml file with httpservice into a XMLListCollection.
All I am looking to do is load an xml file into a XMLListCollection with httpservice and then show it in the text area as a list of children within the XMLListCollection.
Tried many methods and cannot get any to work for me??
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" ">
<mx:Script><![CDATA[
import mx.collections.XMLListCollection;
import mx.utils.ObjectProxy;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
[Bindable]
public var datalist:XMLListCollection;
public function doSend(search:String):void
{
xmlFromDatabase.url = "./includes/flexsearchxml.php?search="+search;
xmlFromDatabase.send();
}
//THIS IS WHERE I CANNOT GET THE HTTPSERVICE REQUEST RESULT STORED IN DATALIST AS AN XMLLISTCOLLECTION< THEN SHOW THE RESULT IN TEST(TEXTAREA)
private function resultHandler(event:ResultEvent):void{
//datalist.source = new XMLList(event.result.data.row);
//datalist = new XMLListCollection(event.result.data.row);
var xmlList:XMLList = new XMLList(event.result.data.row);
datalist.source = xmlList;
//datalist = new XMLListCollection(xmlList);
//datalist = _xlcCatalog;
test.text=datalist.children();
//datalist = event.result.data.row;
//test.text=event.result.toLocaleString();
}
]]>
</mx:Script>
<mx:HTTPService url="./includes/flexsearchxml.php" id="xmlFromDatabase" showBusyCursor="true" result="resultHandler(event)" method="GET" resultFormat="e4x"/>
<mx:TextInput id="textinput" width="478" textAlign="center" keyUp="doSend(textinput.text)"/>
<mx:TextArea id="test" width="300" height="100">
</mx:TextArea>
</mx:Application>
This code comes from a larger application and I have removed surplus un-needed code, when I run this same code using a variable _xlcCatalog, which is an XMLListCollection, everything works fine, and the resulting XMLList from _xlcCatalog is listed in the text area on keyup within the textinput field.
Any assistance is appreciated, thanks
Showmehow