5 Replies Latest reply on Jan 1, 2009 7:36 PM by Ned Murphy

    Controlling one flash file from an embed one

    mikeyjray Level 1
      I have built 2 flash files - one with all of the content, and one with all of the menu buttons, (I did this so I can update the "buttons.swf" file without having to edit the "content.swf" file). I have no problem loading the "buttons.swf" file using the loadMovie function, but I don't even know where to start when trying to control the "content.swf" file.

      The buttons should be able to control the gotoAndPlay function of the "content.swf" file so they can control the pages that appear in the "content.swf" file.

      How would I go about doing this, and where would I need to add the code? Into the "buttons.swf" file, the "content.swf" file, both, or is it even possible?

      Thanks
      Mike
        • 1. Controlling one flash file from an embed one
          Ned Murphy Adobe Community Professional & MVP
          Chances are you can utilize the following (3 options shown in one)... let's say one of the buttons' instance name is "btn" in the menu, and the menu is being loaded into the content file... in the timeline of the menu file...

          btn.onRelease = function(){
          _root.gotoAndStop(2); // OR
          _level0.gotoAndStop(2); // OR
          _parent.gotoAndStop(2);
          }
          • 2. Re: Controlling one flash file from an embed one
            mikeyjray Level 1
            Hi Ned,

            I'm using the attached code, where btnholder_mc is the instance name of the box to hold "buttons.swf"

            Using this code "buttons.swf" loads correctly, however, I don't know how to make this movie control the gotoAndPlay function of "content.swf".

            I should mention that "buttons.swf" has 7 different buttons within it, each of which I would like to load a different page within "content.swf". I don't know if this is doable, but I'm trying to do it as such so I only have to update 1 file full of 7 buttons, rather than 7 different files, each with their own button (for the purposes of changing themes/design/etc.)

            I know that if I loaded each individual button as a movie I could place an onRelease listener to each to run the gotoAndPlay function, but I want to avoid having 7 different button movies. Any ideas?

            • 3. Controlling one flash file from an embed one
              Ned Murphy Adobe Community Professional & MVP
              There's no problem with the seven-in-one approach... create seven of those code things in the button.swf's timeline having a unique instance name for each button. You do not need any code in the content movie for navigating it, except possibly for stop(); commands and content related code related to the content you travel to via the buttons.

              btn1.onRelease = function(){
              _root.gotoAndStop(2);
              }

              btn2.onRelease = function(){
              _root.loadMovie(etc...);
              }

              btn3.onRelease = function(){
              _root.gotoAndPlay(3);
              }

              etc...
              • 4. Re: Controlling one flash file from an embed one
                mikeyjray Level 1
                Ned - you solved my problem! Working like a charm!

                Thank you!
                • 5. Re: Controlling one flash file from an embed one
                  Ned Murphy Adobe Community Professional & MVP
                  You're welcome Mike.