phiroh
May 2nd, 2005, 12:01 PM
Hi everyone,
I am trying to load a xml file which was created by a php-file into flash.
the problem is, it works when I open it in a browser but not in flash>export or in a standalone player. When I load a .xml file its okay, but not the .php
Any ideas?
AS:
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
date_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
comment_txt.text = "loading";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pathto.php");
PHP:
<?php
//header("Content-type: text/xml"); --> otherwise wouldn't work at all
require ( 'config.php' );
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM cons_test ORDER BY date DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<entries>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<entry>\n";
$xml_output .= "\t\t<date>" . $row['date'] . "\n";
// Escaping illegal characters
$row['comment'] = str_replace("&", "&", $row['comment']);
$row['comment'] = str_replace("<", "<", $row['comment']);
$row['comment'] = str_replace(">", ">", $row['comment']);
$row['comment'] = str_replace("\"", """, $row['comment']);
$xml_output .= "\t\t<text>" . $row['comment'] . "\n";
$xml_output .= "\t</entry>\n";
}
$xml_output .= "</entries>";
echo $xml_output;
?>
I am trying to load a xml file which was created by a php-file into flash.
the problem is, it works when I open it in a browser but not in flash>export or in a standalone player. When I load a .xml file its okay, but not the .php
Any ideas?
AS:
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
date_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
comment_txt.text = "loading";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pathto.php");
PHP:
<?php
//header("Content-type: text/xml"); --> otherwise wouldn't work at all
require ( 'config.php' );
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "SELECT * FROM cons_test ORDER BY date DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<entries>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<entry>\n";
$xml_output .= "\t\t<date>" . $row['date'] . "\n";
// Escaping illegal characters
$row['comment'] = str_replace("&", "&", $row['comment']);
$row['comment'] = str_replace("<", "<", $row['comment']);
$row['comment'] = str_replace(">", ">", $row['comment']);
$row['comment'] = str_replace("\"", """, $row['comment']);
$xml_output .= "\t\t<text>" . $row['comment'] . "\n";
$xml_output .= "\t</entry>\n";
}
$xml_output .= "</entries>";
echo $xml_output;
?>