5 Replies Latest reply on Jul 26, 2007 5:26 PM by arcorob

    executing functions from dynamically loaded swf files on as3

    Lujunq Level 1
      Hi, when I load an external swf file I would like to be able to run some funtions defined on it (considering both applications - my "main one" and the one that I loaded ar as3 files). Howeve I an even unable to locate the loaded swf... Here is some code to explain my question better:

      at may main application
      import flash.display.Loader;
      import flash.display.Sprite;
      import flash.events.*;
      import flash.net.URLRequest;

      var loader:Loader = new Loader();
      loader.addEventListener(Event.COMPLETE, completeHandler);
      var request:URLRequest = new URLRequest("mySWF.swf");
      loader.load(request);
      addChild(loader);

      function completeHandler(event:Event):void {
      trace ("loaded");
      isok();
      }

      function isok() {
      // from here I would like to call a function from the loaded swf
      }

      at the file I want to load
      function myfunction():void {
      trace ("function called");
      }


      How can I do this? How can I locate the file I just loaded and access its function?