Greetings,
as i created mysql database using wamp server, i created a table with 6 products in it,
and php file creates an xml file with text which is finally loaded into flash, it loads all the text into 1 single ‘list’ component, it works nicely
but all the text is all grouped in 1 single component
but what im trying to do is to separate each record to load in a separate text field
and finally i need to load an image with each record, i realize that each image must be linked from xml file
here is my php code that creates the xml file:
<?PHP
$link = mysql_connect("localhost","lee","password");
mysql_select_db("brimelow_store");
$query = 'SELECT * FROM products';
$results = mysql_query($query);
echo "<?xml version=\"1.0\"?>
";
echo "<products>
";
while($line = mysql_fetch_assoc($results)) {
echo "<item>" . $line["product"] . "</item>
";
}
echo "</products>
";
echo "<image>
";
echo "http://localhost/logo/logo1.jpg";
echo "</image>
";
mysql_close($link);
?>
here is my actionscript:
var theXML:XML = new XML();
theXML.ignoreWhite = true;
theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for(i=0;i<nodes.length;i++) {
theList.addItem(nodes*.firstChild.nodeValue,i);
my_products.addItem(nodes*.firstChild.nodeValue,i);
txt_products.text = _root.my_products;
}
}
theXML.load(“http://localhost/products.php”);
what am i doing wrong?
currently everything works fine (except of the image loading)
and all the 6 records is grouped into 1 single ‘list’ component
how could i load these 6 records into 6 individual text fields? + image in each record
i’ve been working on this for few days now, i haven’t had a proper rest its killing me
anyone? any suggestions?