0 Replies Latest reply on Mar 16, 2011 9:38 PM by The Aryeh

    Posting an Appended XML Object to Server using AS3 with PHP in Flex 4

    The Aryeh Level 1

      Hey Everyone,


      I've scoured the internet looking for help with this problem, and I'm assuming the issue is fairly obvious.  I'm guessing there is just something I'm not aware of going on here and my low-level knowledge can't pick it up.  What I'm trying to do is append an XML file on my hosting account with some XML data generated in my AIR app (I'm using Flash Builder 4 Burrito).  I'm using a small PHP script to tell it to do so, and its one that works in an AS3 flash animation/website/whatever (so I know it works to some extent).  Every time I try the code in my AIR app, however, it wipes my XML file clean and doesn't append anything.  I get a positive return on event complete though.  Heres my code:



      <?xml version="1.0" encoding="utf-8"?>

      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"









      private var myXML:XML = new XML();


      private function appInit():void{

      goBtn.addEventListener(MouseEvent.MOUSE_UP, makeGroupbtn_clickHandler);



      private function makeGroupbtn_clickHandler(event:MouseEvent):void{

      var newName:String="Pew";

      var newFull:String="Pew";

      var newItem:XML=XML("<tier><innertier>"+newName+"</innertier><innertiertwo>"+newFull+"</inner tiertwo><tier>");



      var request:URLRequest=new URLRequest("http://www.mydomain.com/messages.php");




      var loader:URLLoader = new URLLoader();


      loader.addEventListener(Event.COMPLETE, check);



      private function check(event:Event):void{







      <!-- Place non-visual elements (e.g., services, value objects) here -->


      <s:Button id="goBtn" x="285" y="317" label="Button"/>




      Heres my PHP:




      if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){

          $xml = $GLOBALS["HTTP_RAW_POST_DATA"];

          $file = fopen("myxml.xml","wb");

          fwrite($file, $xml);






      Like I said, it works flawlessly on a website I have it running on.  As far as I can tell it has something to do with the AIR environment and its aversion to file loading.  I'm guessing that I just need to specify something else in order to get things working.  Thanks for your help guys.
      The Aryeh