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.  

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.

Open in new window

flash-php-mysql-integration-Scen.swf
Christopher CaseySr Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CyanBlueCommented:
I don't know what you meant by the 'crazy blinking', but it sounds like you might have some error happening with your ActionScript...  Do you get any error message when you create the SWF file???

CyanBlue
0
Christopher CaseySr Systems AdministratorAuthor Commented:
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.
0
CyanBlueCommented:
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
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Christopher CaseySr Systems AdministratorAuthor Commented:
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.
0
CyanBlueCommented:
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
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);
	}
}

Open in new window

0
Christopher CaseySr Systems AdministratorAuthor Commented:
yes i and doing a test movie in flash

try the new code and tested on web server still no output
0
CyanBlueCommented:
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
0
Christopher CaseySr Systems AdministratorAuthor Commented:
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");

Open in new window

0
CyanBlueCommented:
Aha...  There is a typo in 'lenght' which should be 'length'...
   for (var i:Number = 0; i < nodes.length; i++)

CyanBlue
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Christopher CaseySr Systems AdministratorAuthor Commented:
God Damn i hate typo

Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.