View Full Version : PHP/MYsql and flash

04-23-2003, 05:36 PM
Hey there fellow actionscripters just a quick question for someone out there greater than me....heres my issue ::

im doing a flash site for a local band that wants a 'news' section that they can update and whatnot....the importance being....THEY UPDATE IT. so im thinkin MySQL backend, and a PHP script that pulls the values from the DB....easy. NOW COMES THE HARD PART i wanna know if theres a decent tutorial out there or at least someone who knows here how to make flash read all the rows/columns in from the PHP script and like automatically add new MC's whenever theres a new row in the database..i imagine you would use duplicateMovieClip....

can anyone help me to create this news section? i would be the most greatful s.o.b you have ever seen

thanks a million!

04-24-2003, 11:55 AM
you're on the right track there - you would read in the data, the list of news items or whatever which could be a loadvars or could be an xml doc, then loop through that either adding mcs or just writing it into a dynamic text field.......quick and dirty example:

//generated by php
<item title="Hello Everybody!">
Yes indeed
<item title="Goodbye everybody!">
So long

and in your movie:

news_xml = new XML();
news_xml.ignoreWhite = true;
news_xml.onLoad = doNews;
function doNews() {
var n = this.firstChild.childNodes;
var l = n.length;
for (var i = 0; i<l; i++) {
_root.news_txt.text += n[i].attributes["title"]+": "+n[i].firstChild.nodeValue+"\n";

and if you have a dynamic textfield on the stage called news_txt this will write it in.....have a try then look at some tutorials on this site and www.flsh-db.com maybe.........good luck