5 Replies Latest reply on Sep 24, 2010 2:32 PM by kglad

    AS2 - need help with menu movieclips

    n2dzyne Level 1

      This is urgent so if anyone can solve this quickly, I would be so grateful!

       

      Template my client bought. It is AS2.

       

      On the buttons themselves which are actually movie clips, this is the code:

      onClipEvent (load) {

                      num = 1;

           link = "index.html";

      }

       

      onClipEvent (load) {

                      num = 2;

                      link = "index.html";

      }

       

      Each number corresponds with the buttons name. In these 2 instances, 1=home and 2=web design.

       

      Inside those menu movie clips is all the work on the timelines that make the animation happen. On the hit button is this code:

       

      on (rollOver) {

                      if (_root.link<>num) {

                                      gotoAndPlay("s1");

                                      _root.l["l"+num].gotoAndPlay("s1");

                                      _root.l["l"+(num-1)].gotoAndPlay("s1");

                      }

      }

      on (releaseOutside, rollOut) {

                      if (_root.link<>num) {

                                      gotoAndPlay("s2");

                                      _root.l["l"+num].gotoAndPlay("s2");

                                      _root.l["l"+(num-1)].gotoAndPlay("s2");

                                      _root.for_line = num;

                      }

      }

      on (release) {

                      if (_root.link<>num) {

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

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

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

                                      _root.l["l"+(_root.link-1)].gotoAndPlay("s2");

                                      _root.link = num;

                                      _root.all_sub_button["item"+_root.link].gotoAndPlay("s1");

                                      getURL(link);

                      }

      }

       

      Here’s what I need to do. I need the buttons to open up an external swf on the main timeline. Right now, they are linking to an external html. How can I do that?

       

      I also have another issue with these buttons regarding how they are sized. They are not all the same size when you publish the file because the original menu items were longer than what I have changed them to. But I don’t see any way to change the size of them (the blue part).

       

      Thank you!

        • 1. Re: AS2 - need help with menu movieclips
          kglad Adobe Community Professional & MVP

          elsewhere (probably on the main timeline), there's code that uses the value of link to load your html files.  you'll need to edit that code.

           

          and i don't see any way to help you resize objects via a forum.  you'll need to search your fla or have someone else do that for you.

          • 2. Re: AS2 - need help with menu movieclips
            n2dzyne Level 1

            Yes, the code to link to an html is on the button "link = "index.html" which is called by the hit button inside that movie clip "getURL

            (link)". But I don't want it to call a link. I want it to call an external swf to the main timeline inside an empty movie clip I have created. But when I tried to put in _root.empty_mc.loadMovie("home.swf"); on the main button movie clip in place of the "link = index.html", it doesn't work. I get an "undefined" error.

            • 3. Re: AS2 - need help with menu movieclips
              kglad Adobe Community Professional & MVP

              that link="index.html" probably does nothing.  it's the on(release) code where link is assigned a number that's the key to what's loaded.

              • 4. Re: AS2 - need help with menu movieclips
                n2dzyne Level 1

                Actually, the link does do something and I've been able to make some progress but now it's another issue.

                 

                Here's the code on the menu movieclip (there are 9 menu buttons and each one is coded so that it's supposed to pull up the corresponding SWF):

                 

                HOME BUTTON:

                 

                onClipEvent (load) {
                num = 1;
                link = "home.swf";
                }

                 

                WEB DESIGN BUTTON:

                 

                onClipEvent (load) {
                num = 2;
                link = "webdesign.swf";
                }

                 

                --------------------------------------------------------

                 

                Here's the action inside the button:

                on (rollOver) {
                if (_root.link<>num) {
                  gotoAndPlay("s1");
                  _root.l["l"+num].gotoAndPlay("s1");
                  _root.l["l"+(num-1)].gotoAndPlay("s1");
                }
                }
                on (releaseOutside, rollOut) {
                if (_root.link<>num) {
                  gotoAndPlay("s2");
                  _root.l["l"+num].gotoAndPlay("s2");
                  _root.l["l"+(num-1)].gotoAndPlay("s2");
                  _root.for_line = num;
                }
                }
                on (release) {
                if (_root.link<>num) {
                  _parent["item"+_root.link].gotoAndPlay("s2");
                  _root.all_sub_button["item"+_root.link].gotoAndPlay("s2");
                  _root.l["l"+_root.link].gotoAndPlay("s2");
                  _root.l["l"+(_root.link-1)].gotoAndPlay("s2");
                  _root.link = num;
                  _root.all_sub_button["item"+_root.link].gotoAndPlay("s1");
                  _root.empty_mc.loadMovie(link); THIS IS WHAT I CHANGED FROM THE ORIGINAL POST
                }
                }

                 

                On the main timeline is an empty movieclip. The problem is that the only swf that is working is the home.swf. Even though the webdesign.swf was a copy of the home document, it doesn't load correctly. See example here:  http://www.n2dzyne.com/testing/vsm_flash_v4.html. NOTE, the only buttons with code on them right now that are supposed to work are HOME, WEB DESIGN, WEB HOSTING, AND LOGO DESIGN. All of these are pointing to the home.swf except the web design and the logo design.

                 

                I am baffled as to why it would load the home.swf but not the others when the others were created from the same file and the only thing I changed was the file name.

                • 5. Re: AS2 - need help with menu movieclips
                  kglad Adobe Community Professional & MVP

                  1.  your target movieclip no longer exists or is not visible or

                   

                  2.  link's value is incorrect.

                   

                   

                  use the trace() function to see if your target movieclip exists.