A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Where does XML go when it leaves Flash?

  1. #1
    Junior Member
    Join Date
    Jan 2003
    Posts
    1

    Where does XML go when it leaves Flash?

    I'm trying to create a very simple XML-based Flash movie.

    My movie reads in a couple text nodes from a locally-stored xml file ("test.xml"), changes their values and (hopefully) exports the new XML back to the file.

    I've got two out of three, but am pretty lost on how to write the file back to the server.

    Here's the relevant AS:

    The first frame loads the XML file:

    content_xml = new XML();
    content_xml.load("test.xml");


    Another script, attached to a button, changes the appropriate values then tries to send the new XML back to the server (here's where I get lost):

    on (release) {
    content_xml.send("write.php");
    }


    "write.php" is a PHP file living on the server which is supposed to write the XML file based on the POST data from the Flash movie.

    I'm not attached to PHP if someone else has a suggestion in CGI or some other method.

    However, in PHP I tried the following:

    PHP Code:
    <html>
    <body>

    <?php
      
    if (isset($_POST["confirm"]))//posted?
      
    {

        
    $fp=fopen("test.xml","w");//overwrite existing text file
        
    fwrite($fp,var_export($_POST,TRUE));//write post-data
        
    fclose($fp);
      }
    ?> 
    </body>
    </html>
    It doesn't work. Anyone have any ideas? Many thanks...

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    From the Flash XML FAQ:

    PHP Code:
    <?
    // make sure you have the proper permissions to write to this file
    $filename = "xmloutput.txt";
    $fp = fopen( $filename,"w+");
    fwrite ( $fp, "$HTTP_RAW_POST_DATA" );
    fclose( $fp );
    print '<?xml version="1.0"?><result>LOGIN OK</result>';
    ?>
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center