4 Replies Latest reply on Nov 20, 2006 9:34 AM by Newsgroup_User

    Navigation question

    Level 7
      In my movie I have lots of buttons and when the user click on a button, it
      takes him to a certain frame on the timeline. However, hardcoding each
      button seems like a lot of waste of time and space. Is there a modular way
      of scripting the navigation, e.g. using a variable like *myName* so that
      when the user clicks a button say *button1*, it takes the user to the frame
      that is also labelled as *button1*? I use this method in Director but not
      sure how to do it in Flash MX.

      Any help would be greatly appreciated.

      Nishi


        • 1. Re: Navigation question
          2m Level 2
          actually there are several ways to accomplish that. Probably the easiest way is naming the frames in a meaningfully way, and giving the instances of the buttons (movieClips) an identifying name that matches.

          The script inside the button-clip could then check for its own name and send the play-head to the frame of the same name.
          • 2. Re: Navigation question
            Level 7
            for ( var k in _root ) {
            if ( k.indexOf("button") == 0 ) {
            _root[k].onRelease = doRelease ;
            }
            }

            function doRelease() {
            _root.gotoAndStop(this._name) ;
            }

            "Sharma" <nrsharma@onetel.com> wrote in message
            news:ejrqeo$fih$1@forums.macromedia.com...
            > In my movie I have lots of buttons and when the user click on a button, it
            > takes him to a certain frame on the timeline. However, hardcoding each
            > button seems like a lot of waste of time and space. Is there a modular way
            > of scripting the navigation, e.g. using a variable like *myName* so that
            > when the user clicks a button say *button1*, it takes the user to the
            > frame that is also labelled as *button1*? I use this method in Director
            > but not sure how to do it in Flash MX.
            >
            > Any help would be greatly appreciated.
            >
            > Nishi
            >


            • 3. Re: Navigation question
              Level 7
              Thanks for your help. Unfortunately, I couldn't make it work and am
              wondering what I am doing wrong. I placed your script on the button but
              nothing happed when I pressed the button. I wonder where the problem is. I
              presume that I don't have to put the name of my button in the second line as
              that would defeat the objective.

              Nishi

              "Jose Guevara" <joseAT@guevaraDOT.net> wrote in message
              news:ejsca7$7bp$1@forums.macromedia.com...
              > for ( var k in _root ) {
              > if ( k.indexOf("button") == 0 ) {
              > _root[k].onRelease = doRelease ;
              > }
              > }
              >
              > function doRelease() {
              > _root.gotoAndStop(this._name) ;
              > }
              >
              > "Sharma" <nrsharma@onetel.com> wrote in message
              > news:ejrqeo$fih$1@forums.macromedia.com...
              >> In my movie I have lots of buttons and when the user click on a button,
              >> it takes him to a certain frame on the timeline. However, hardcoding each
              >> button seems like a lot of waste of time and space. Is there a modular
              >> way of scripting the navigation, e.g. using a variable like *myName* so
              >> that when the user clicks a button say *button1*, it takes the user to
              >> the frame that is also labelled as *button1*? I use this method in
              >> Director but not sure how to do it in Flash MX.
              >>
              >> Any help would be greatly appreciated.
              >>
              >> Nishi
              >>
              >
              >


              • 4. Re: Navigation question
                Level 7
                Nishi,

                You wanted a script that was more modular this is it. Don't put it on the
                button, put it in the timeline where all your buttons are located. If your
                buttons are not located on the main timeline you will have to change any
                references to _root to the appropriate path, example, if your buttons are
                in a movieclip called menu_mc, then:

                for ( var k in _root.menu_mc )

                and _root.menu_mc[k]

                alternatively you could swap the _root to the keyword this.

                JG


                "Sharma" <nrsharma@onetel.com> wrote in message
                news:ejsn0h$ka3$1@forums.macromedia.com...
                > Thanks for your help. Unfortunately, I couldn't make it work and am
                > wondering what I am doing wrong. I placed your script on the button but
                > nothing happed when I pressed the button. I wonder where the problem is. I
                > presume that I don't have to put the name of my button in the second line
                > as that would defeat the objective.
                >
                > Nishi
                >
                > "Jose Guevara" <joseAT@guevaraDOT.net> wrote in message
                > news:ejsca7$7bp$1@forums.macromedia.com...
                >> for ( var k in _root ) {
                >> if ( k.indexOf("button") == 0 ) {
                >> _root[k].onRelease = doRelease ;
                >> }
                >> }
                >>
                >> function doRelease() {
                >> _root.gotoAndStop(this._name) ;
                >> }
                >>
                >> "Sharma" <nrsharma@onetel.com> wrote in message
                >> news:ejrqeo$fih$1@forums.macromedia.com...
                >>> In my movie I have lots of buttons and when the user click on a button,
                >>> it takes him to a certain frame on the timeline. However, hardcoding
                >>> each button seems like a lot of waste of time and space. Is there a
                >>> modular way of scripting the navigation, e.g. using a variable like
                >>> *myName* so that when the user clicks a button say *button1*, it takes
                >>> the user to the frame that is also labelled as *button1*? I use this
                >>> method in Director but not sure how to do it in Flash MX.
                >>>
                >>> Any help would be greatly appreciated.
                >>>
                >>> Nishi
                >>>
                >>
                >>
                >
                >