3 Replies Latest reply on May 31, 2010 8:35 AM by kglad

    checking an external swf is loaded?

    celebritymusic Level 1

      Hi

       

      I'm loading an external .swf via typing the swf name into an input text field and hitting a submit button.

       

      The swf loads fine, but I'm trying to incorporate updating a status text field on a succesful load or if there is an error during loading.

       

      I can't find my mistake in the code - to me it should be making  load_status_txt display "ok", but the swf just loads with no status update.

       

      All the text fileds are fine, because if I code  load_status_txt.text = "hello" straight after addChild(loader); -  load_status_txt displays "hello"

       

      Can anyone see an obvious mistake below?

       

      Thanks so much again.

       

      Shaun

       

       

       

      loadSwfBut.addEventListener("mouseDown", sendData)


      function sendData(evt:Event){
          if(loadSwf.text !=""){
             
      var Xpos:Number = 0;
      var Ypos:Number = 100;
      var swf:MovieClip;
      var loader:Loader = new Loader();

       

      var defaultSWF:URLRequest = new URLRequest(loadSwf.text);

       

      loader.load(defaultSWF);
      loader.x = Xpos;
      loader.y = Ypos;
      addChild(loader);

       

             
              loader.addEventListener(Event.COMPLETE, dataOnLoad);
             
          } else load_status_txt.text = "All fields are mandatory"
      }

       

      function dataOnLoad(evt:Event): void{

       

          load_status_txt.text = "ok";
         
      }
         
      stop();