views:

113

answers:

1

The Context of the Problem

I'm working on a rotator banner in flash. I use an external xml file to pass the banners info (like info-text, link, image-path, priority, etc). Everything is going well so far. I'm loading the xml something like this:

var bannersXML:XML = new XML();
bannersXML.ignoreWhite = true;
bannersXML.load("myBanners.xml");

The Problem itself

Now I need to construct this xml on-the-fly in php and somehow pass it to my flash object. So instead of read the external file I want my flash script receive an xml parameter it can work with.

Do you know if this can be done?

+3  A: 

Echo out the structure of the XML file with appropriate headers and tell Flash to load your PHP file:

<?
    header("Content-type: text/xml"); 
    $xml_output = "<?xml version=\"1.0\"?>\n"; 
    $xml_output .= "whatever other xml tags"; 
    $xml_output .= "whatever other xml tags"; 
    $xml_output .= "whatever other xml tags"; 
    $xml_output .= "whatever other xml tags"; 
    echo $xml_output;
?>

This is a bit simplified, but that's the idea. Then just call:

bannersXML.load("myBannersPHPfile.php");
Tegeril
If you find this answer useful, please mark as your accepted answer, otherwise let me know where you need clarification and I'll be happy to assist.
Tegeril
Thanks Tegeril. I was just trying it out. It worked. Thanks ;)
David Elizondo
Glad it worked for you. Good luck.
Tegeril