0 Replies Latest reply on Oct 15, 2006 3:11 AM by Mr Binitie

    Listener is not triggered on Event.COMPLETE

    Mr Binitie Level 1
      I have the following code within an <mx:Script> tag in a custom component that extends <mx:Canvas>

      import flash.display.DisplayObject;
      import flash.display.Sprite;
      import mx.validators.ValidationResult;
      import mx.rpc.http.HTTPService;
      import flash.net.*;
      import flash.events.*;
      import flash.utils.*;
      import mx.effects.*;
      import XML;

      private var pSprite:Sprite;
      private var loader:URLLoader;
      private var request:URLRequest;
      private var aXML:XML;
      private var XML_URL:String;

      public function init():void
      {
      writeln("::::init::::");
      loader = new URLLoader();
      XML_URL = "content/img.xml";
      request = new URLRequest(XML_URL);
      loader.load(request);
      loader.addEventListener("complete", onComplete);
      }

      public function onComplete(event:Event):void
      {
      writeln("::::onComplete::::");
      XML.ignoreWhitespace = true;
      loader = URLLoader(event.target);
      aXML = new XML(loader.data);
      writeln(aXML.children().children().length() + "\n");
      //createLevels(lifeXML.children().children().length());
      }

      Ithe init() method is fired but after that nothing. What am I doing wrong? I have a similar piece of code in another as.component and it works.

      [a /]