3 Replies Latest reply on Apr 18, 2007 8:48 AM by kglad

    Loaded movie communicating back to the loader

    jfbaro_uk Level 1
      Hi,

      We have got a swf which loads another swf. everything works fine, we can change things in the loaded movie through the loader. But now we need the buttons in the loaded movie calling a method or trigging an event in the loader. We have been doing that by using LocalConnection, but now we need another approach.

      How to do that?

      Cheers
        • 1. Re: Loaded movie communicating back to the loader
          kglad Adobe Community Professional & MVP
          localconnection would be used if there are two swfs open in different browser windows or different applications. i don't see where you are doing that.

          if you are loading an external swf into a main swf, you reference objects and variables using the correct relative or absolute path.

          the main timeline in the main swf can always be referenced by _level0 from anywhere. so, if you want to reference a button in the main swf that's on the main timeline you would use:

          _level0.yourButton

          if you yourButton is in a movieclip, mc, that's on the main timeline in your main swf, use:

          _level0.mc.yourButton
          • 2. Re: Loaded movie communicating back to the loader
            jfbaro_uk Level 1
            Hi Kglad,

            Thanks for helping,

            you are right, we have been using LocalConnection because we had two separeted SWF.
            But now we have got another project where we will have one SWF loaded into it by loadMovie();

            As we are new to Flash and ActionScript, what we really would like to know is how could we call a method in a movie clip located in the loader SWF, say mc_loader. We have created a new class (extended from MovieClip) and inserted a new method on it called dispatch(pValue:String).

            then, from the loaded SWF we have tried, as you said,

            _level0.mc_loader.dispatch("Test");

            and also:

            _level0.dispatch("Test"), but the method/function is not being called.

            Thanks very much
            • 3. Re: Loaded movie communicating back to the loader
              kglad Adobe Community Professional & MVP
              mc_loader must be a member of the class and must be on the main timeline of your loading swf.