24 Replies Latest reply on Dec 24, 2007 6:34 AM by kglad

    Masked menu with easing through buttons

    lou_bra Level 1
      Hello,

      I have been working on a masked menu and the idea is to make it move only ¨y¨. But not with mouse over or down on the menu, but, over the two buttons UP and the other one DOWN... making with this the scrollable buttons mask in the mc and start moving.

      I’m using a action like this, and I think this is not appropriated to the mc, and I don’t know which action to configure to the buttons:

      onClipEvent (mouseDown) {
      ycenter = 170;
      speed = 1/50;
      }
      onClipEvent (enterFrame) {
      var distance = _root._ymouse-ycenter;
      _y += (distance*speed);
      }

      I’m working with action script 2.

      And, one more thing that is not working at all…I have configured actions like the below one to the buttons, which works fine while the buttons are not inserted inside a mc. When I convert the buttons to a single mc, they don’t work any longer, and I do have just one scene.

      on (release) {
      gotoAndStop("aguilar");
      a.loadMovie("imagenes/artistas/aguilar/paco1_p.jpg");
      }

      Does someone know how to do configure it. I haven’t find any tutorial to that specific function, and I’m running without time..

      Thanks a lot for any help:)
        • 1. Re: Masked menu with easing through buttons
          kglad Adobe Community Professional & MVP
          what's the instance name of the menu that needs to scroll? do you want it to scroll when your up and down buttons are pressed? when they are rolledover?
          • 2. Re: Masked menu with easing through buttons
            lou_bra Level 1
            hello kglad, thanks for your attention once again

            the name of the instance is ¨artist¨, and the idea is to make it work when the mouse is pressed. there are these two buttons who should manage the easing of the masked mc

            • 3. Re: Masked menu with easing through buttons
              kglad Adobe Community Professional & MVP
              do you want artist to continue to scroll as long as an up (or down) button is being pressed? or do you want to scroll some fixed amount with each button press?

              if it's the former, artist will ease to what position?
              • 4. Re: Masked menu with easing through buttons
                lou_bra Level 1
                yes for the first question.

                artist is a mc with 9 buttons in that. Only five are visible because of the mask. in another layer I have two buttons which should make the mc start moving.

                take a look at http://www.galerianomesart.com/index_cast.htm

                the right menu. its something like that

                my fla its at iaram.net/tiresies and at the frame 60 layer menu, you can see that I´m trying to do the same

                thanks for all
                • 5. Re: Masked menu with easing through buttons
                  kglad Adobe Community Professional & MVP
                  you can't use easing unless there's a target value into which you want to ease.
                  • 6. Masked menu with easing through buttons
                    lou_bra Level 1
                    hello kglad,

                    you know that exemple i gave you http://www.galerianomesart.com/index_cast.htm

                    in that case there is no real easing, and i guess i'm opting for this. a mc artist (which has 2 bottons in another layer), when pressed start making the masked mc goes up and down.

                    do you have an idea of whith code should i put on the arrows and at the movielclip? I really tryed finding it over the internet, but what i have found was not to this kind of effect.

                    that code i was using was not apropriated considering that was not made to be controled by buttons, but by the mouse easing over the mc.

                    thanks a lot if you could give me a direction on how to do it,

                    • 7. Re: Masked menu with easing through buttons
                      kglad Adobe Community Professional & MVP
                      create button rollOver methods that start a loop (like setInterval or onEnterFrame) and in your rollOut methods terminate that loop. within the loop body update your masked movieclip's _y property.
                      • 8. Re: Masked menu with easing through buttons
                        lou_bra Level 1
                        thanks, but i still dont know how to do it. which action should i use in the mc?

                        which action should i use in the buttons to control the mc movement?

                        i'm very thankfull for this, at this moment i just cant find it anywere and i'm not a programmer. i'm just trying to configure the menu to work well under the page's design,

                        thanks again,
                        • 9. Re: Masked menu with easing through buttons
                          kglad Adobe Community Professional & MVP
                          if your masked movieclip has instance name menuMC, your mask has instance name maskMC and your up button has instance name upButton, you can use:

                          • 10. Re: Masked menu with easing through buttons
                            lou_bra Level 1
                            thanks kglad

                            I will try applying it, latter I tell you,

                            thanks again
                            • 11. Re: Masked menu with easing through buttons
                              kglad Adobe Community Professional & MVP
                              you're welcome.
                              • 12. Re: Masked menu with easing through buttons
                                lou_bra Level 1
                                hello,

                                It seems it is working…

                                I created also a downButton to the other arrow and tried to put it in the code to make the movement in the other direction (down), but it didn’t worked :(

                                Also, referring to the speed I tried using the script assist putting a number (2) instead of dir*speed; and it gave no syntax error, but it stills moving very fast.

                                upButton.onRollOver=function(){
                                clearInterval(scrollI);
                                scrollI=setInterval(scrollF,60,-1);
                                }
                                upButton.onRollOut=function(){
                                clearInterval(scrollI);
                                }
                                downButton.onRollOut = function() {
                                clearInterval(scrollI);
                                }
                                function scrollF(dir){
                                menuMC._y = dir*speed; // define speed
                                if(menuMC._y<maskMC._height-menuMC._height+maskMC._y){ // define a limiting condition
                                menuMC._y = maskMC._y;
                                }
                                }

                                Other problem… The buttons that are contained inside the movieclip were working fine before I convert them to mc (menuMC). They had actions like this, that aren’t working no more:

                                on (release) {
                                gotoAndStop("denz");
                                a.loadMovie("imagenes/artistas/denz/margit1_p.jpg");
                                }

                                You know what I can change in the codes to have those working good? I’m lost over this..

                                Thanks a lot
                                • 13. Re: Masked menu with easing through buttons
                                  lou_bra Level 1
                                  kglad

                                  do you have any idea how to configurate it? now i´m running without time, it really urgent,

                                  thanks a lot
                                  • 14. Re: Masked menu with easing through buttons
                                    kglad Adobe Community Professional & MVP
                                    add another limiting condition to scrollF() and use:

                                    • 15. Re: Masked menu with easing through buttons
                                      lou_bra Level 1
                                      hello, thanks a lot

                                      i am trying to define a limiting condition by putting numbers like 314 or 172 (px height of the menuMC and maskMC) at ._height or _y, but it´s not working well:

                                      if(menuMC._y<maskMC._172-menuMC._314+maskMC._y){

                                      ... what could be wrong,?

                                      thank you
                                      • 17. Re: Masked menu with easing through buttons
                                        lou_bra Level 1
                                        really sorry taking so much of your time and attention. I see it close to conclusion now. One last problem,

                                        The menuMC moves directly from one point to another when the arrows are pressed. Directly and fast.

                                        When downButton is pressed it leads to the end of menuMC (when the last 5 buttons inside de menuMC are visible).

                                        The upButton does the same (to the top of menuMC, and the first 5 visible buttons in it) which is ok (arrows are working), but this is not scrolling gradually. The content in-between can not be accessed.

                                        I have changed the onRollOver to onPress, which is better for the client, but the ideal is that each CLICK would make the menuMC move 35px (32px is the height of each button inside the menuMC + 3px which is the white space between them).

                                        Do you have idea how to set up a gradual scroll to menuMC with a defined height/distance? I dont know about codes and its really hard for me setting new things here.

                                        I’m with the code below now:


                                        upButton.onPress = function() {
                                        clearInterval(scrollI);
                                        scrollI=setInterval(scrollF,60,-60);
                                        }
                                        upButton.onRollOut=function(){
                                        clearInterval(scrollI);
                                        }
                                        downButton.onPress=function(){
                                        clearInterval(scrollI);
                                        scrollI=setInterval(scrollF,60,60);
                                        }
                                        downButton.onRollOut=function(){
                                        clearInterval(scrollI);
                                        }
                                        function scrollF(dir){
                                        menuMC._y = dir*2; // define speed
                                        if(menuMC._y<maskMC._height-menuMC._height+maskMC._y){ // define a limiting condition
                                        menuMC._y = maskMC._y;
                                        }
                                        if(menuMC._y>maskMC._y){
                                        menuMC._y=maskMC._y;
                                        }
                                        }
                                        • 18. Re: Masked menu with easing through buttons
                                          kglad Adobe Community Professional & MVP
                                          in the code i gave, define speed to be 35 and use onPress handlers instead of onRollOver handlers.

                                          or, in the code i gave, change the 60 to something larger to slow the scroll and/or decrease the speed to less than 2.
                                          • 19. Re: Masked menu with easing through buttons
                                            lou_bra Level 1
                                            how do i define speed? is it what i had done in the last code i sent you, putting a 2 instead of the word "speed" in your code?

                                            when i get your pure code and put a 35 like this nothing happens, no movement from the arrows.

                                            when i take your pure code and put a number bigger than 60 still nothing happening...:(

                                            is it maybe that i'm configuring the speed badlly?

                                            the only thing i changed was the OnPress, and the 2, instead of the word "speed"... and also, when i keep the (scrollF,60,-1) or other number different than 60, 60, nothing works again...

                                            in the code i gave you is there something wrong that could not be adapted? if not how to put in your pure code the instructions you gave me now?

                                            I'm extremelly confused..

                                            or the problem is the 2 i put in code, that this is not refering to speed?

                                            how would be your final code? the same thing with a number 35 instead of the word "speed" in:

                                            menuMC._y = dir*2; // define speed

                                            .. really sorry, but now it seems nothing is working:(

                                            and thanks a lot once again kglad
                                            • 20. Re: Masked menu with easing through buttons
                                              kglad Adobe Community Professional & MVP
                                              use the code below. try different values (like .3, 3, 30) for speed in the top line.

                                              after seeing the effects of varying speed from .3 to 30, you should be able to fine tune your choice for speed:

                                              • 21. Re: Masked menu with easing through buttons
                                                lou_bra Level 1
                                                hey, thank you

                                                this code is working good. just one thing is not ok.

                                                Pressing downButton (I am using OnPress) and when it arrives to the end of the menu we are scrolling, it do not stop. It produces a kind of strange loop or something that makes the menuMC get to initial position again.

                                                by this way i can not click at the last button inside the mc, because it jumps authomaticaly

                                                the upButton works perfect and when we arrive to the top of the menuMC it stops.

                                                do you know how to make the downButton stop scrolling menuMC when it arrives at the end?

                                                thanks a lot again
                                                • 22. Re: Masked menu with easing through buttons
                                                  kglad Adobe Community Professional & MVP
                                                  my bad. use:

                                                  • 23. Masked menu with easing through buttons
                                                    lou_bra Level 1
                                                    now!

                                                    this code is working perfectly.. really nice. thanks a lot kglad. I'm sorry I toke so much of your time,

                                                    cheers:)

                                                    • 24. Re: Masked menu with easing through buttons
                                                      kglad Adobe Community Professional & MVP
                                                      you're welcome.