hi
i`m not sure if i`m in the right plcae but i`m desparate:)
i have a php file that takes the data from a database and convert it as xml, because the new abilities to work with xml in flash are great (no more disfunctional families issues:).
when i output the php file to the browser i get the xml i needed.
but when i try to load this php file in flash ,i do not get the xml.
if i take copy the xml the pgp outputed and load it as xml file it works, but obviously that goes against making things dynamic.
this is the php file:
$host= "localhost";
$db="";
$username="";
$pass="";
$link=mysql_connect($host,$username,$pass) or die(mysql_error());
mysql_select_db($db);
$q="SELECT * FROM contacts";
$r=mysql_query($q);
$row=mysql_fetch_assoc($r);
$total_rows=mysql_num_rows($r);
//headers
header('Content-type:text/xml');
header('Cache-control:private');
header('Expires:-1');
?>
'); ?>
0) { // Show if recordset not empty ?>
$value) { ?>
<>
>
and this is the flash AS3 code:
import fl.data.DataProvider;
var addRequest:URLRequest= new URLRequest("addBookToXML2.php");
var addLoader:URLLoader= new URLLoader(addRequest);
var addXML:XML= new XML();
addXML.ignoreWhitespace=true;
addLoader.addEventListener(Event.COMPLETE,doGrid);
function doGrid (evt:Event):void {
//trace(evt.target.data);
//trace (addXML.person.firstName.text());
addXML = XML(evt.target.data);
var myDP:DataProvider = new DataProvider(addXML);
aDg.dataProvider= myDP;
aDg.setSize(600,200);
aDg.columns= ["firstName","lastName","phoneNum","email"];
aDg.columns[0].width= 80;
aDg.columns[1].width= 80;
aDg.columns[2].sortable=false;
aDg.columns[3].sortable=false;
aDg.editable=true;
aDg.move(80,50);
}
add_btn.addEventListener(MouseEvent.CLICK, addIt);
delete_btn.addEventListener(MouseEvent.CLICK, deleteIt);
update_btn.addEventListener(MouseEvent.CLICK, updateIt);
aDg.addEventListener(Event.CHANGE, takeChange);
function takeChange (evt:Event):void {
//trace(evt.target.selectedIndex);
//addXML.update();
}
function addIt (evt:MouseEvent):void {
//trace("selectedIndex is: " +aDg.selectedIndex) ;
}
function deleteIt (evt:MouseEvent):void {
aDg.removeItemAt(aDg.selectedIndex);
}
function updateIt (evt:MouseEvent):void {
//trace (aDg.selectedIndex);
}
i hope someone can help me with it.
best regards
ron