3 Replies Latest reply on Sep 13, 2006 6:56 PM by jpwrunyan

    How do I access methods inside loader content?

    jpwrunyan Level 1
      I posted a similar question in the General Discussion but, when I load an SWF with the Loader class, how do I access variables and methods on that SWF? Is it possible?
        • 1. Re: How do I access methods inside loader content?
          Level 7
          Load function enables you to load an swf inside a MovieClip (you choose its
          name). Then simply by typing the name you chose followed by a plot and the
          function's name or object you want to access, you just tells the player to
          execute that function or read/write the variable's value.

          Just as in:

          this.createEmptyMovieClip(..., "myclip",...);
          myclip.myVar= "This is the clip's variable content";
          myclip.myfunction("hi", "that's all");

          I hope it helps.

          Carlos.
          "jpwrunyan" <jpwrunyan@hotmail.com> escribi� en el mensaje
          news:edoao4$4mk$1@forums.macromedia.com...
          >I posted a similar question in the General Discussion but, when I load an
          >SWF with the Loader class, how do I access variables and methods on that
          >SWF? Is it possible?


          • 2. Re: How do I access methods inside loader content?
            Daniel Hai Level 1
            var externalSWF:MovieClip = _loader.content; // or _loader.getChildAt(0);
            externalSWF.whatever();

            if it's an external swf and you don't know the type, you can either have the external swf extend a package within your calling swf, or use:

            var fn:Function = externalSWF['somefunctionname'];
            fn.apply(externalSWF, [param1, param2])
            • 3. Re: How do I access methods inside loader content?
              jpwrunyan Level 1
              Thanks guys,
              I originally thought that I should be able to access the functions like you showed but was getting an error. At least I know the error wasn't from the code written on the side actually loading the .swf.