# Hide/Show List Component

**URL:** https://forum.kirupa.com/t/hide-show-list-component/267542
**Category:** flash
**Created:** [August 2, 2008, 1:41pm UTC](https://forum.kirupa.com/t/hide-show-list-component/267542 "2008-08-02T13:41:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![briand5](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@briand5](https://forum.kirupa.com/u/briand5)
#### Post date: [August 2, 2008, 1:41pm UTC](https://forum.kirupa.com/t/hide-show-list-component/267542/1 "2008-08-02T13:41:54Z")

</div>

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](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
