6 Replies Latest reply on May 12, 2007 2:48 AM by nikising

    How to target main timeline from within 3 mcs in a slidemenu?

    nikising
      Hello there,

      I am trying to modify a slidemenu script but don't really know how to accomplish it. I have a series of buttons within three mcs. (this is necessary for the sliding script to work). In the original script, the button name is targeted to a label with the same name in a new scene.

      The code on the button is:

      on (release) {
      gotoAndStop("/:" add eval("..:text"));
      // THIS goes to the FRAME with the name of the button you just clicked on.
      }

      The MC code is:

      // --------------------------------------------
      // tmi=total menu items
      // dup=new movie duplicates
      // butn=original movie button
      // --------------------------------------------
      // FIX original Button:
      butn:text = /:Menu0;
      while (Number(n)<Number((/:tmi*2)-1)) {
      n = Number(n)+1;
      dup = "butn" add n;
      duplicateMovieClip("butn", dup, n);
      setProperty(dup, _x, Number(getProperty(dup, _x))+Number(n*getProperty(dup, _width)));
      setProperty(dup add "/b", _x, getProperty (dup add "/b", _x) + (1));
      set(dup add ":n", n);
      // assign button name from variables
      if (Number(n)<Number(..:tmi)) {
      set(dup add ":text", eval("/:Menu" add n));
      } else {
      set(dup add ":text", eval("/:Menu" add (n-/:tmi)));
      }
      }


      The problem I am having is that I don't want to go to a new scene ( because I am only loading photos) but would like to target a label on the main menu. I have tried many ways including (my label is named "one"):

      on (release) {
      _root.gotoAndStop("Main" "one");
      }

      on (release) {
      _root.gotoAndStop("one");
      }

      on (release) {
      gotoAndStop("Main" "one");
      }
      on (release) {
      _level0.gotoAndStop("one");
      }

      But none of these work. There must be a way to do this no? Please someone enlighten me! I need all the help I can get.

      Thanks very much for your support,

      Niki
        • 1. Re: How to target main timeline from within 3 mcs in a slidemenu?
          mercl Level 1
          Hi,
          i don't where you got this code but it looks like Ascript used in flash 4...
          and it's full of syntax errors...

          don't know if this is what you want want but why not try something like:

          nrOfBtns = 4;
          //position for each button
          // make button on the root like : myBtn. (mClip or Btn clip )
          buttonStep = myBtn._width+10 // or_height
          // for each button make click tag i.e. in an array is allways nice
          clickTag = new Array();

          clickTag[0] = "labelName 0";
          clickTag[1] = "labelName 1";
          clickTag[2] = "labelName 2";

          // create loop
          for (i=0; i<nrOfBtns; i++) {
          // gives you myBtn_0 _1 ,etc.
          duplicateMovieClip("myBtn", "myBtn_"+i, i);
          // places each button 0X150 = 0, 1X150 = 150 position etc.
          _root["myBtn_"+i]._x = i*_root.buttonStep;
          // add other things like click commands:
          // like wich label in the root to goto coming from the array
          _root["myBtn_"+i].clickTag = _root.clickTag ;
          _root["myBtn_"+i].onRelease = function() {
          _root.gotoAndPlay(this.clickTag);
          trace(this.clickTag);
          }
          }


          hope i could help
          ML


          • 2. Re: How to target main timeline from within 3 mcs in a slidemenu?
            nikising Level 1
            Hi ML,

            Thanks so much for the advice. I am going to try and figure out what you are talking about! I am not very good at Actionscript so I'm pretty much going to copy and paste the code so I hope that this code will work in the 3 mcs structure. Yes? The thing is, I don't know what an array is!

            Sorry I didn't explain really what I am going for. The sliding menu is horizontal and slides each direction according to the mouse position. Basically, all I want is for the thumbnail photo buttons in the menu to open the corresponding photo larger above the menu. I will try this code. If you have any other ideas to accomplish this, let me know,

            Thanks so much for your help. I have been struggling at this now for two weeks!

            Niki
            • 3. Re: How to target main timeline from within 3 mcs in a slidemenu?
              nikising Level 1
              Hi ML,

              Hmmm maybe if you have some times can you explain a bit where I put this code? Maybe just a bit more explanation. Sorry about that. I am not a scripter.

              Thanks so much,
              Niki
              • 4. How to target main timeline from within 3 mcs in a slidemenu?
                nikising Level 1
                Hi ML,

                I put three buttons in a movie clip named mybtn and put this script:

                onClipEvent (load) {
                nrOfBtns = 3;
                buttonStep = myBtn._width+10;
                // or_height
                // create loop
                for (i=0; i<nrOfBtns; i++) {
                // gives you myBtn_0 _1 ,etc.
                duplicateMovieClip("myBtn", "myBtn_"+i, i);
                // places each button 0X150 = 0, 1X150 = 150 position etc.
                _root["myBtn_"+i]._x = i*_root.buttonStep;
                // add other things like click commands:
                // like wich label in the root to goto coming from the array
                _root["myBtn_"+i].clickTag = _root.clickTag;
                _root["myBtn_"+i].onRelease = function() {
                _root.gotoAndPlay(this.clickTag);
                trace(this.clickTag);
                };
                }
                }
                • 5. Re: How to target main timeline from within 3 mcs in a slidemenu?
                  nikising Level 1
                  Hi ML,

                  where did you go?

                  Niki
                  • 6. Re: How to target main timeline from within 3 mcs in a slidemenu?
                    nikising Level 1
                    Hi ML,

                    Trying to find you! Where did you go? You are the only person I've found with some suggestions but I need to ask you questions!

                    Thanks,
                    Niki