4 Replies Latest reply on Aug 12, 2008 7:24 AM by kglad

    Get an URLVarioable in AS3

    Level 7
      in my mainclass I call a sellf made fileStringloader class
      The fileStringloader class is reading a textfile and gets the
      variable pairs. It works fine. But I can't use this information
      in my main class.

      public class fileStringloader extends MovieClip
      public function fileStringloader()
      var request : URLRequest = new URLRequest("control\\tn.txt");
      public var loader : URLLoader = new URLLoader();

      loader.addEventListener( IOErrorEvent.IO_ERROR, handleIOError);
      loader.addEventListener( HTTPStatusEvent.HTTP_STATUS, handleHttpStatus);
      loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR,
      loader.addEventListener( Event.COMPLETE, handleComplete);
      loader.dataFormat = URLLoaderDataFormat.VARIABLES;
      function handleComplete( event:Event)
      var loader2:URLLoader =URLLoader(event.target);
      public var data :URLVariables = loader2.data as URLVariables;
      trace("Loader.data = " + loader2.data);

      ***************** The trace works fine if I user my Main Class:

      public class mainclass extends MovieClip
      public function mainclass()
      var a: fileStringloaderr= new fileStringloader;


      ***************** But how can I get the loader 2.date variable in my main

      Any idea?

      Many thanks for interest