Ive created a search engine in flex not to elaborate and it works to a certain extent. the timeline is i input a word and hit the search button it sends the word to a php script that looks in the database for entries in a table that match then returns the values of the rows to the php file and spits out an xml file. The xml is then parsed by the search engine and the nodes are put into an array collection whos data is then used by my itemRenderer to populate a list component.
Now the problem i have is that if i input a search word that i know has more than one entry in the database all the code works the search works and it populates the list properly. However if i input a word that has only 1 or no entry it get the error #1009 and i cant figure out why. i kind of understand if the arrayCollection has nothing in it since its a null object but when i know theres an entry it makes no sense why its spitting that error out.. heres my mxml code for the search engine..
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="644" height="374" backgroundColor="#ffffff">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable] private var resultList:ArrayCollection;
[Bindable] private var resultHolder:ArrayCollection;
/* private function init():void
{
writeData.send();
} */
public function startSearch():void
{
var validEntry:Boolean = ! ( search_txt.text == "" );
if ( validEntry )
{
var objSend:Object = new Object();
objSend.searchee = search_txt.text;
writeData.send(objSend);
}
else
{
Alert.show("Please input a search");
}
}
private function faultHandler(event:FaultEvent):void
{
Alert.show('There was a problem');
}
private function resultHandler(event:ResultEvent):void
{
try
{
resultList = writeData.lastResult.businesses.business;
}
catch(error:Error)
{
Alert.show("Unable to display results!");
}
}
]]>
</mx:Script>
<mx:HTTPService id="writeData" url="searcher2.php" showBusyCursor="true"
fault="faultHandler(event)" result="resultHandler(event)" useProxy="false" method="POST" />
<mx:VBox id="my_searcher" paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10" width="644" height="374">
<mx:FormItem direction="horizontal" width="100%" paddingLeft="-14">
<mx:TextInput id="search_txt" width="100%" />
<mx:Button id="search_it" label="Search" click="startSearch()"/>
</mx:FormItem>
<mx:List id="rl" dataProvider="{resultList}"
itemRenderer="components.resultRenderer" width="100%" height="100%">
</mx:List>
</mx:VBox>
</mx:Canvas>
if you need to see the custom itemRenderer code let me know and ill post..Please help i have no idea why its not working and im really pressed for time..Thank you in advance for those who can help..