4 Replies Latest reply on Oct 22, 2007 11:58 AM by kglad

    sending variables

    pandxsg Level 1
      Someone please help me before I pull my last remaining hair out...>_<

      Let's say I have 2 movie clips, "main.swf" and "section.swf" playing simultaneously, and "section.swf" is layered on top of "main.swf". How do I manipulate a variable of "main.swf" from "section.swf"?

      For example, there is a background music in "main.swf" which I wish to stop from "section.swf", how do I do that?

      Thanks!
        • 1. Re: sending variables
          LB Back Level 1
          in section.swf you could use _parent.main_swf.yourVariable
          I don't think you can use the name .swf though as flash will probably assume the dot is part of a path.
          • 2. Re: sending variables
            pandxsg Level 1
            quote:

            Originally posted by: LB Back
            in section.swf you could use _parent.main_swf.yourVariable
            I don't think you can use the name .swf though as flash will probably assume the dot is part of a path.


            I've recently got a similar situation and tried the above method, but it's not working. I tried loadMovieNum("menu.swf", 2) and loadMovieNum("section1.swf",1) to load a menu on top on a particular section of the site. I needed to access a dynamic textfield on menu.swf, which I have named as "desc", from section1.swf. I used the following code on a button from section1.swf:

            onRollOver(){
            _parent.menu_swf.desc="hi, this is working!";
            }

            However, nothing shows up when I rollover on the button. Anyone knows why?

            Thanks!

            • 3. Re: sending variables
              nstanz
              go into the help file and search for LocalConnection constructor under ActionScript 2.0... it does exactly what you want and is simple.
              • 4. Re: sending variables
                kglad Adobe Community Professional & MVP
                you needn't use localconnect because your swfs are not in separate browser instances. just use the correct path:

                _level2.desc.text="hi, this is working";