PDA

View Full Version : Flash and MySQL



X34R0
June 30th, 2006, 06:02 PM
Hello All,

I have created the database and the php to output my XML needed for my presentation but now, I don't know what to do with flash to only present 4 of the results on the page. How would I do this with actionscript?

creatify
June 30th, 2006, 06:24 PM
If you have php running - then I'd look into amfphp remoting for an option - you don't have to go through the XML and can work on single records. It does take some getting used to and you'll have to set up some php file (the have samples / code on the site) - just another option http://www.amfphp.org

jgreenethumb
July 1st, 2006, 02:02 PM
if you are interested in learning the best practices for DB communication with Flash, AMFPHP is your best bet... however, if you just need to get this done and want to use XML, it is pretty easy to limit your results... you can either limit your MYSQL query

i.e.) SELECT * FROM tablename LIMIT 4

--or--

if you return one large black of XML into your flash document, just loop through the desired amount of nodes.

for example:


var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = parseXML;
myXML.load('yourXML.xml')

function parseXML()
{
var rootNode:XMLNode = this;
var counter = 0;
for (var i=0; i<4; i++) //chooses first 4 nodes
{
//do something with the node you want, right now its just tracing...
trace(rootNode.childNodes[i]);
}
}


hopefully this helps..