Hello, I am currently trying to learn how to use MySQL, PHP/XML, and Flash together. What I have so far is a list box that loads the MySQL table “subject” through the following code:
PHP File:
$query = ‘SELECT * FROM subjects WHERE subjects.master_id = 1 AND subjects.visible = 1 ORDER BY subjects.item_name’;
$results = mysql_query($query);
echo "<?xml version="1.0"?>
";
echo "<subjects>
";
while ($line = mysql_fetch_assoc($results)) {
echo “<item>” . $line[“item_name”] . "</item>
";
}
echo "</subjects>
";
ActionScript:
SubjectList.setStyle(“themeColor”, “haloBlue”);
SubjectList.setStyle(“textSelectedColor”, “000080”);
SubjectList.setStyle(“embedFonts”, “True”);
SubjectList.setStyle(“fontFamily”, “Verdana”);
var SubjectXML:XML = new XML();
SubjectXML.ignoreWhite = true;
SubjectXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for (i=0;i<nodes.length;i++) {
SubjectList.addItem(nodes*.firstChild.nodeValue,i);
}
}
SubjectXML.load(“http://localhost/SubjectXML.php”);
This code works exactly how I want it to but what I now want to do is have each list item in the list (when clicked) show another list component that will display the corresponding product items from the MySQL “items” table.
I was thinking of creating a new flash file for each set of items and then have the subject list display the SWF files but I want to be able to add new subjects without having to go back into flash and do more coding.
Thank you to anyone who can give me a hand with this.
Thanks,
Brian