0 Replies Latest reply on Jul 16, 2007 7:38 PM by oneofhero

    using actionscrpt and return a value

      In my source code, I try to post a xml file on a api. Then the server send back to flash. myLoader.data will contain the response from the server. I can see the myLoader.data in xmlloaded function has the data that i needed. I try to return the xml file back to the Test1(main) function. How can I do it? By the way, the getXML function does not work.

      package {
      import flash.display.Sprite;
      import flash.events.*;
      import flash.net.*;

      public class Test1 extends Sprite {

      private var myLoader:URLLoader = new URLLoader();
      var myXMLURL:URLRequest = new URLRequest(" some api");

      public function Test1() {

      //add xml data in the myXMLURL
      myXMLURL.contentType ="text/xml";
      myXMLURL.method = URLRequestMethod.POST;
      myXMLURL.data = "<?xml version=\"1.0\"?><!DOCTYPE REQUEST SYSTEM ......";
      myLoader.addEventListener(Event.COMPLETE, xmlLoaded);

      //some action after the xml file return form the server

      private function xmlLoaded(event:Event):XML{
      return XML(myLoader.data);

      private function getXML():XML{

      return myLoader.data;