I am trying to create a search of a mySQL database using
flash as the front end and PHP as the business logic. The search
term is entered into a text input field, that term is sent back in
XML form via a LoadVars.sendAndLoad. I can specify a target, but
thats the end of it. I can trace it and it works, so I know its
getting back to me.
What I'm having trouble with is using the returned XML data
and displaying it in a datagrid component. Do I return it in a new
XML object, do I have to parse it, do I have to loop it and put it
into an array. dataProvider, addelements, Aaargh! I'm totally lost.
I dont know how to use any of these statements.
Here is what I have so far...
var searchResultsXML:XML = new XML ();
searchResultsXML.onData = function (str) {
trace(str);
}
var searchEngine:Object = new Object ();
searchEngine.click = function ()
{
var searchTerm:LoadVars = new LoadVars ();
searchTerm.term = searchField_txt.text;
searchTerm.sendAndLoad("URL to php script",
searchResultsXML, "POST");
}
searchButton.addEventListener("click", searchEngine);
Here is the trace results....
<?xml version="1.0"?>
<citybiz>
<business>
<name>MIRACLE EAR SEARS HEARING AIDE
CENTER</name>
</business>
<business>
<name>SEARS AUTO CENTER 2969</name>
</business>
</citybiz>
Any help would be great!