Christopher Casey
asked on
PHP, MySQL,and Flash
I did that this guy did
http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php
And it's not working i am using flash cs4.
http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php
And it's not working i am using flash cs4.
php code works great it displays the data just find.
<?
mysql_connect("localhost", "name", "password") or die(mysql_error());
mysql_select_db("Flash") or die(mysql_error());
$query="SELECT * FROM products";
$result=mysql_query($query);
echo "<?xml version=\"1.0\"?>\n";
echo "<products>\n";
while($line = mysql_fetch_assoc($result)) {
echo "<item>" . $line["product"] . "</item>\n";
}
echo "</products>\n";
mysql_close();
?>
The flash code is
var theXML:XML = new XML ();
theXML.ignoreWhite = true;
theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for(i=0;i<nodes.lenght;i++) {
theList.addItem(nodes[i].firstChild.nodeValue,i);
}
}
theXML.load("http://www.mysite.com/flash.php");
When i try to view the flash file is goes in some crazy blinking.
flash-php-mysql-integration-Scen.swf
ASKER
line 6 1120: Access of undefined property i.
line 7 1137: Incorrect number of arguments. Expected no more than 1.
line 4 Warning: 1090: Migration issue: The onLoad event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'load', callback_handler).
line 11 Warning: 3594: load is not a recognized method of the dynamic class XML.
line 7 1137: Incorrect number of arguments. Expected no more than 1.
line 4 Warning: 1090: Migration issue: The onLoad event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'load', callback_handler).
line 11 Warning: 3594: load is not a recognized method of the dynamic class XML.
It sounds like the tutorial is done in AS2 and you are trying to compile it in AS3... Try using AS2 and see if that works for you...
CyanBlue
CyanBlue
ASKER
yep tried that and it doesn't display the xml just a blank list box.
but if i run the php code it displays the database info.
but if i run the php code it displays the database info.
Are you testing it inside the Flash IDE???
Try changing the theXML.onLoad handler to this and see if you get anything in the Output panel...
CyanBlue
Try changing the theXML.onLoad handler to this and see if you get anything in the Output panel...
CyanBlue
theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for(var i:Number = 0 ; i < nodes.lenght ; i++) {
trace("nodeValue " + i + " = " + nodes[i].firstChild.nodeValue);
theList.addItem(nodes[i].firstChild.nodeValue, i);
}
}
ASKER
yes i and doing a test movie in flash
try the new code and tested on web server still no output
try the new code and tested on web server still no output
No, I was asking that because I wanted you test inside the Flash IDE to see if the trace line that I added works or not...
CyanBlue
CyanBlue
ASKER
well i tried just a xml file and still no output
<?xml version="1.0"?>
<products>
<item>Why do people die</item>
<item>Why do you like pie</item>
</products>
and this as the flash code
var theXML:XML = new XML ();
theXML.ignoreWhite = true;
theXML.onLoad = function() {
var nodes = this.firstChild.childNodes;
for(var i:Number = 0 ; i < nodes.lenght ; i++) {
trace("nodeValue " + i + " = " + nodes[i].firstChild.nodeValue);
theList.addItem(nodes[i].firstChild.nodeValue, i);
}
}
theXML.load("display.xml");
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
God Damn i hate typo
Thank you
Thank you
CyanBlue