11 Replies Latest reply on Mar 14, 2012 7:49 PM by Ned Murphy

    Help with Re-Linking Navigation Buttons

    autocadmstr

      I have Adobe Flash CS3 Pro.

      I have a navigation header flash file that came with my website template and I am having difficulty making sense of the actionscript. It has a logo section with effects, 5 main nav buttons that move, and two extra link buttons above the navigation bar. Let’s focus on just the Navigation buttons for now. Here is what I have gathered. I have multiple text buttons on one movieclip, and I have successfully edited the text for each button. If I look at the actionscript in the top layer of this movieclip I see:

       

      “gotoAndStop(parent._parent.num);”

       

      I also have a separate movieclip symbol (with effects) with 5 buttons layers listed in the actionscript with the following actionscript tied to each button from numbers 1 through 5:

       

      onClipEvent (load) {

                  num=1;

      }

       

      onClipEvent (load) {

                  num=2;

      }

       

      onClipEvent (load) {

                  num=3;

      }

       

      onClipEvent (load) {

                  num=4;

      }

       

      onClipEvent (load) {

                  num=5;

      }

       

      On the top layer of these 5 buttons I have the following actionscript:

       

      stop();

      this["item"+_root.button].gotoAndPlay("s1");

      _root.link = _root.button;

       

      I also have a separate button symbol with the following actionscript:

       

       

      on (rollOver) {

                  if (_root.link<>1) {

                              menu.item1.gotoAndPlay("s1");

       

                  }

       

      }

       

      on (releaseOutside, rollOut) {

                  if (_root.link<>1) {

                              menu.item1.gotoAndPlay("s2");

                  }

      }

      on (release) {

                  if (_root.link<>1) {

                              _root.menu["item"+_root.link].gotoAndPlay("s2");

                              _root.link = 1;

       

                              getURL("index.html");

       

                  }

      }

       

      Now my website template came with 5 html pages that my flash navigation buttons correspond to: (index.html, index-1.html, index-2.html, index-3.html, index-4.html, index-5.html). My problem is that I have created new pages (index.html, about.html, featured.html, projects.html, contact.html). I would like each of the 5 buttons to correspond to these pages, not the existing standard “index-n.html” pages. 

       

       

      Also, this is probably not relevant, but each html page has something to this affect so I can see how they correspond to each button.

        

      <script type="text/javascript">

                var fo = new FlashObject("flash/menu_vf8.swf?button=2", "head", "100%", "144", "7", "");

                fo.addParam("quality", "high");

                          fo.addParam("wmode", "transparent");

                              fo.addParam("scale", "noscale");

                fo.write("head");

              </script>

       

      I guess my real question is: What actionscript do I need to update or remove for the nav button LINKS to work with my new html pages rather than the standard 5 index-n.html pages that it automatically wants to link to?

       

      When I try and add a “getURL” command to each of the 5 buttons and test preview the movie, the links work, but it messes up the effects of the movieclip. In other words, the buttons don’t move, they are motionless, however the links work. If I added this command to each button in some way, what actionscript would I need to remove so there weren’t any complications? I need some expert help here for it would be much appreciated. I am a novice with Flash script and its killing me that I can’t figure it out. I asked for help from the template support and all they came back with was the following message and it wasn’t helpful:

       

      1. You need to duplicate each button you are editing - it is very important.

        2) Update the scripting to look similar way:

        on (release) {
        if (_root.link<>num) {
        _parent["item"+_root.link].gotoAndPlay("s2");
        _root.link = num;
        if (num == 1) {
        getURL("index.html");
        } else {
        getURL("index-"+Number(num-1)+".html");
        }
        }
        }

        Update it to:

        on (release) {
        getURL("http://www.google.com");
        }

      menu.jpg

      Also, I read through the following discussion, which was helpful to a degree, but it still didn’t answer my questions about getting the links to work.

      http://forums.adobe.com/message/3614092#3614092

        • 1. Re: Help with Re-Linking Navigation Buttons
          autocadmstr Level 1

          The picture depicts 7 buttons only because I added two extra buttons to my navigation bar. Sorry for the confusion.

          • 2. Re: Help with Re-Linking Navigation Buttons
            Ned Murphy Adobe Community Professional & MVP

            For each of the 5 buttons (to be 7), do you see code "on" them similar to what you showed for your "separate button symbol"

            • 3. Re: Help with Re-Linking Navigation Buttons
              autocadmstr Level 1

              First of all, thank you for showing interest and helping out in my dilemma here. I wish I understood your meaning behind “on” because with my luck there is probably some hidden way of placing script on an object that I don’t understand or haven’t discovered yet.

               

              This is what I know:

               

              I have multiple text buttons on one movieclip entitled “textbutton1” (see previous picture), and I have successfully edited the text for each button and created two extra frames/buttons to make 7 total. If I look at the actionscript in the top layer of this movieclip I see:

               

              “gotoAndStop(parent._parent.num);”

               

              But there is no action on each individual frame (all 7 of them) on that layer.

               

              Like I mentioned before I have a separate movieclip symbol (entitled “menu effect”) with 7 button movieclip layers listed in the actionscript with the following actionscript on each layer.

               

              onClipEvent (load) {

                          num=1;

              }

               

              onClipEvent (load) {

                          num=2;

              }

               

              onClipEvent (load) {

                          num=3;

              }

               

              onClipEvent (load) {

                          num=4;

              }

               

              onClipEvent (load) {

                          num=5;

              }

              onClipEvent (load) {

                          num=6;

              }

               

              onClipEvent (load) {

                          num=7;

              }

               

               

              On the top layer (layer 4 frame 25) of these 5 buttons I have the following actionscript:

               

              stop();

              this["item"+_root.button].gotoAndPlay("s1");

              _root.link = _root.button;

               

               

               

              I can upload another particular image of the movieclip/actionscript if it would be helpful. Let me know.

              • 4. Re: Help with Re-Linking Navigation Buttons
                Ned Murphy Adobe Community Professional & MVP

                For that other button you showed code in the form of...

                 

                on (rollOver) {... etc

                 

                That code is what I call "on" an object (a bad practice).  It is not on the timeline but is attached to the object.  You can only see that code when you click on that object while the Actions window is opened.

                 

                So if you click on those other 5 buttons you are concerned with, do they have similar "on" code?

                • 5. Re: Help with Re-Linking Navigation Buttons
                  autocadmstr Level 1

                  No they do not. With the action window open, the only "on" code I see is that one button entitled "hit 11" (see picture) that I mentioned earlier with the following script:

                   

                  on (rollOver) {

                              if (_root.link<>1) {

                                          menu.item1.gotoAndPlay("s1");

                   

                              }

                   

                  }

                   

                  on (releaseOutside, rollOut) {

                              if (_root.link<>1) {

                                          menu.item1.gotoAndPlay("s2");

                              }

                  }

                  on (release) {

                              if (_root.link<>1) {

                                          _root.menu["item"+_root.link].gotoAndPlay("s2");

                                          _root.link = 1;

                   

                                          getURL("index.html");

                   

                              }

                  }

                   

                  I have tried clicking on every layer/frame/object/symbol/text/etc with the action window open and the only "on" code I can find is what i have already mentioned. There has to be more "on" code like this though right? This can't be the only script that causes the buttons to got to the different html pages such as "index-2.html" right? It just baffles me.

                  • 6. Re: Help with Re-Linking Navigation Buttons
                    autocadmstr Level 1

                    If I am not mistaken I believe the rollover on code mentioned above correlates to the logo, not the menu buttons. So, there has to be some "on" code hiding somewhere for the menu buttons right?

                    • 7. Re: Help with Re-Linking Navigation Buttons
                      Ned Murphy Adobe Community Professional & MVP

                      If the buttons have "on" code it will be where I said you will find it... on the buttons.  It is possible that your buttons are movieclips, which can mean that the real buttons for them are located within the movieclips, just as the textfields are.  If you could doubleclick your buttons open to the stage where you have access to the textfield, then you might find the button there on a layer as well... with the code on it.  If you happen to see any aqua-colored areas inside your buttons, those are most likely the actual buttons.

                       

                      The better way to code is to assign instance names for the buttons and have code in the timeline that targets the buttons using their instance names.  Instance names are assigned in the Properties panel.  If you select one of your buttons and you do not see an instance name assigned to it in the Properties panel, then chances are the code is deeper within the button.

                      1 person found this helpful
                      • 8. Re: Help with Re-Linking Navigation Buttons
                        autocadmstr Level 1

                        Okay, you were spot on. I did find more "on" code with an aqua-colored area that I apparently missed. Under "menu1" I have a movieclip that is entitled "button." Within this movieclip i found multiple layers and frames, one layer entitled "hit" with the following action script:

                         

                        on (rollOver) {

                        if (_root.link<>num) {

                          gotoAndPlay("s1");

                        }

                        }

                        on (releaseOutside, rollOut) {

                        if (_root.link<>num) {

                          gotoAndPlay("s2");

                        }

                        }

                        on (release) {

                        if (_root.link<>num) {

                          _parent["item"+_root.link].gotoAndPlay("s2");

                          _root.link = num;

                          if (num == 1) {

                           getURL("index.html");

                          } else {

                           getURL("index-"+Number(num-1)+".html");

                          }

                        }

                        }

                         

                        I still have the problem with not having separate buttons to assign getURL script to. It appears I am stuck with 7 buttons in one with an actionscript controlling what page to send it to based on the position or item number. How can I get around this? I am assuming this script here needs replacing, but I don't know how to code "if" scripts. Appreciate your time, patience and input Ned. I mean that. You've been a big help so far.

                        • 9. Re: Help with Re-Linking Navigation Buttons
                          autocadmstr Level 1

                          You mentioned the word "instances" found in the properties.

                          I believe my "instances" of the button are "item1" "item2" "item3" and so on through 7 on my movieclip entitled "menu effect" This movieclip has all the movieclip button layers with the following script for each layer. Does that help clarify? (again, see picture)

                           

                          onClipEvent (load) {

                          num=1;

                          }

                          • 10. Re: Help with Re-Linking Navigation Buttons
                            autocadmstr Level 1

                            I am assuming the following code is all i need to modify correct?

                             

                            if (num == 1) { 

                               getURL("index.html");

                              } else {

                               getURL("index-"+Number(num-1)+".html");

                              }

                            }

                            }

                             

                            Would I replace the underlined script with an action that would refer it to my new pages (about.html(num-2), featured.html(num-3), projects.html(num-4), video.html(num-5), news.html(num-6), contact.html(num-7))???

                            • 11. Re: Help with Re-Linking Navigation Buttons
                              Ned Murphy Adobe Community Professional & MVP

                              From what I can make of the code you now show, this is an approach that I have seen somewhat regularly for AS1/2 designs.  Those "num" values are what specifies the html pages that get linked.  Each button is assigned a num value, in your case 1 thru 5. 

                               

                              Based on the line of code...

                               

                              getURL("index-"+Number(num-1)+".html"); 

                               

                              I will guess that the pages your header links were named index-1.html thru index-4.html.  If you can see why I say that, there is hope you can resolve this yourself.

                               

                              If you want to link new pages you will either have to name them to agree with that convention, meaning rename about.html to index-1.html, rename featured.html to index-2.html, etc... or change the way the num values are defined or put to use.