A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Flash, XMP and PHP

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    13

    Question Flash, XMP and PHP

    Evening everyone,

    I am having a bit of trouble getting my head around this XML into flash then editing with PHP business. Is there a tutorial anywhere that can help me with this problem?

    I’m basically after getting flash to show certain XML data, being allowed to modify the value of certain XML data and then saving changes to the XML file.

    I know this is done with the help of PHP but I can’t seem to find anything tutorial wise to help me with this, anyone got any advice/links? All help appreciated in advance.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    13
    Quote Originally Posted by a_modified_dog View Post

    Thanks dog, i'll have a look

  4. #4
    Junior Member
    Join Date
    Mar 2009
    Posts
    13
    eermrrmmm ok I think I have it now....in a sence lol

    It seems to be sending the information and the PHP element is opening the file, only problem is it wipes the document :-( any ideas what I have done wrong, here my AS code

    Code:
    var myXML:XML = new XML();
    myXML.ignoreWhite = true;
    myXML.onLoad = processXML;
    var RootNode:XMLNode;
    
    myXML.load("chart.xml");
    function processXML(success:Boolean):Void {
    					if (success) {
    						RootNode = myXML.firstChild.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
    					}
    					else {
    						trace ("Error loading XML file");
    					}
    					}
    					
    myBut.onRelease = function(){
    myXML.sendAndLoad("save.php", myXML);
    }
    and heres my PHP code

    Code:
    <?php
    $file = fopen("chart.xml", "w+"); //the w+ mode truncates the file to 0 length for us :)
    $xmlString = $_GLOBALS["HTTP_RAW_POST_DATA"]; //you need to use this with xml.send()
    print "XML:".$xmlString."\n";
    if(!fwrite($file, $xmlString)){
    print "Error :(";
    }
    fclose($file);
    ?>

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    hmmm... no idea why your file fails

    my file is working OK. can you simulate my set-up ?
    when you see that working, try modifying to your needs

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