php mysql flash communication problem, havent a clue where to start…

By chaudiovisual | Jul 5, 2009

actionscript3

hi all,

I am having a huge problem and need a fix or at least to be pointed in the right direction quickly.

I am working on a massive flash project for which I have quite a large deadline tomorrow. I have 8 movie clips on my stage, and each of these clips has a number of entities which need to be loaded and changed by data from a database. These entities are all dynamic text boxes bar one thing:

the name of the clip, the id of the clip, its internal colour, a question, and an answer to this question. I have already created a table using phpMyAdmin that is laid out like this:

name - number - colour - question - comment

There are currently 2 rows in this table but there will eventually be 8 minimum as I am still largely in test mode. I found a tutorial for as2 (bare with me :) ), which shows me how to take a single source of data from a database and then parsing the xml generated inside of actionscript and add each item to a list. However, taking into account that I am a complete newbie when it comes to xml and php and mysql, I am very confused as to how I could access all these details using php, using the below php and as code as a template:

AS2 Code
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[i].firstChild.nodeValue, i);
}
}

theXML.load("http://www.leebrimelow.com/products.php")

PHP Code
<?PHP

$link = mysql_connect("localhost", "lee", "password");
mysql_select_db ("chaudio_ge");

$query = ‘SELECT * FROM products’;
$results = mysql_query($query);

echo "<?xml version =\"1.0\"?>\n>";
echo "<products>\n";

while ($line = array mysql_fetch_assoc($results))
{

echo "<item>" . $line["product"] . "</item>\n";

}

echo "</products>\n";
mysql_close ($link);

?>

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0