View Full Version : newb - so what's the relationship for flash, php, mysql, and xml
leadtrum
October 2nd, 2004, 01:09 PM
am i wrong in thinking that you can use just php, mysql, and flash to make a flash based site that uses dynamic data.
i've been told that using xml is also part of this equation but I'm confused on its connection. is it the same manner as a .txt file of old where php writes to that file and then flash reads it?
Voetsjoeba
October 2nd, 2004, 01:46 PM
Pretty much yeah. But it's not limited to that. XML doesn't have to be a part of it, though using XML will provide a huge step forward in keeping things organised and structured. An XML file is prettier to look at and 1000 times as structured as using a .txt file. Basically, Flash calls PHP, PHP gets the SQL data, parses it into an XML file, which Flash will then read. Jubba/Vash wrote a great tutorial on it: http://www.kirupa.com/web/mysql_xml_php.htm
leadtrum
October 2nd, 2004, 07:35 PM
is there a way to skip the xml step or is that needed, or is some kind of text file is needed?
just seems like a lot of steps to get things working with a database, sorta makes me wonder why i shouldn't just try and accomplish things in php and html.
CyanBlue
October 2nd, 2004, 07:42 PM
You do not need the XML file of text file if you don't have any use for it...
In other words, you can have your Flash call the PHP script and PHP does the database interaction and then returns the data back to Flash directly... :)
Voetsjoeba
October 3rd, 2004, 08:41 AM
You do not need the XML file of text file if you don't have any use for it...
In other words, you can have your Flash call the PHP script and PHP does the database interaction and then returns the data back to Flash directly... :)
Of course, that's what we're talking about, but for Flash to read it, you'll need PHP to output the data in either the txt format or the xml format :P I prefer XML because it is so, so superior to the messy txt format (var=foo&var2=foo2&var3=foo3...)
leadtrum
October 3rd, 2004, 12:28 PM
reading up through a lot of these tutorials i think i get it...thanks everyone for their input
CyanBlue
October 3rd, 2004, 02:48 PM
Of course, that's what we're talking about, but for Flash to read it, you'll need PHP to output the data in either the txt format or the xml format :P I prefer XML because it is so, so superior to the messy txt format (var=foo&var2=foo2&var3=foo3...)Hey, Voetsjoeba... :)
You don't have to have PHP output the data in a format of an actual file to read in the Flash... (Not that I don't think you don't know this, but to make this clear, of course... :))
You can have your PHP to echo out the string like this...
<?
echo("var=foo&var2=foo2&var3=foo3");
?>
and Flash should be able to read it in the onLoad handler...
some_lv.onLoad = function (ok)
{
if (ok)
{
trace(unescape(this));
}
else
{
trace("Error loading data from the PHP script...");
}
}
So, my point is that you only need to output the extra file only when you have another use for it... Otherwise, you do not have to create one... Not that you cannot... :)
As for the text file vs XML file... I guess it all depends on how big/complex the output is, but generally speaking, I "think" plain text file is better because XML parsing in Flash sucks... It takes too long to load/parse the XML file in Flash... I hope they fix that in the later version... :(
Voetsjoeba
October 3rd, 2004, 05:00 PM
Yeah I know ... I wasn't talking about an extra file. I was talking about Flash requesting the PHP page, PHP getting data and parsing as XML and outputting it (to itself, not to another file), and then Flash reads it. But either way, for Flash to read it, you're gonna have to use either XML or the txt format.
CyanBlue
October 3rd, 2004, 06:11 PM
Hehe... Yup... Got it... :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.