5 Replies Latest reply on Feb 11, 2013 1:23 AM by Atlas020

    Can't figure what's wrong in my menu rollover/rollout project

    Atlas020

      What I was trying to do is make menu similar to one from http://www.jeremylevine.com/

      I was seeking around and couldn't find a clue how was it done, so I tried my way.

       

      Here's what I did  - http://atlasinvest.me/menu/

       

      You'll notice that, when crossing from middle button to one of the other two, it falls down smoothly, but when crossing from side buttons to the middle, it fails to play the frame that should do the smooth part of animation.

       

      Here's the source http://atlasinvest.me/menu/menu.fla

       

      I was trying to figure why it doesn't play, since code is the same for both buttons, but I'm obviously missing something.

       

      Maybe the second pair of eyes would spot something and I'd be thankful

       

      And the other question.. is there any less complicated way from what I'm heading to.. in order to make menu like in the first link above ?

        • 1. Re: Can't figure what's wrong in my menu rollover/rollout project
          Ned Murphy Adobe Community Professional & MVP

          I will bet that the approach taken by the site you link as an example is not done using timeline tweening, but is moreso code-based tweening. 

           

          If you do something to color up your slats you might begin to see some things you need to address.  I am guessing that you do not do any swapping of depths such that the currently largest object is not necessarily lying in front of the others.  If you color them up you will probably see that.  That might account for why things are switching when you don't expect them to.

           

          If you observe the example menu you linked, you'll notice the currently hovered object stands in front of all others, but the change to the next is determined by the position of the cursor relative to each of the objects rather than rolling over them which is what I will guess yours is doing.

           

          You might stand an easier chance with doing this if you were to abandon AS2 and approach a code-based solution using AS3 where you can change the indexing (depth) of the objects more easily.

          1 person found this helpful
          • 2. Re: Can't figure what's wrong in my menu rollover/rollout project
            Atlas020 Level 1

            Thank you Ned for helping again,


            I appreciate your suggestion that these modern code based tweens are much more easily done in AS3, but I'm currently stuck to AS2, since this menu is the last remaining part of the large website I did in AS2 already.

             

            Regarding your notice that buttons may be overlaping each other, I took that into consideration and separated buttons to avoid this issue, but my main problem still remained:

             

            Script is simply ignoring a line of code that is telling it to go and play named frame in movieclip. After the line i did "trace(Message)"  which appears correctly, but the line above just does not do it's work.

             

            It just throws me into a rebus

            • 3. Re: Can't figure what's wrong in my menu rollover/rollout project
              Ned Murphy Adobe Community Professional & MVP

              You should include your code in your posting and explain the setup it supports.  Most people will not download files in these forums.

              • 4. Re: Can't figure what's wrong in my menu rollover/rollout project
                Atlas020 Level 1

                Probably it's something most won't bother, but I thought it may be more convinient because code itself may be a little hard  to figure through, without following content.

                 

                Ok, I'll try to explain as much as I can

                 

                Every button has it's rollover, rollout action depending on current possition of other movieclip (button). By that I tried to tell the clip, if the cursor is coming from the next button, or blank scene.

                There are 3 button sizes : Normal, Large1, and Large 2. As you probably figured, selected button has size Large2, and neighbour buttons follow with size Large1, rest of them are normal.

                 

                So, by default, every rollover goes from frame "Normal to Large2" and rollout goes from frame "Large2 to Normal". After reaching "Normal" it goes and stops to frame 1.

                 

                Before doing default action, it checks if one of the neighbour buttons is Not on frame 1 (which means it's travels from frame Large2 to Normal, and that neighbour button was previously active), and then if that's the case, it redirects neighbour button to play "Large2 to Large1" and current button to go from "Large1 to Large2".

                 

                And here's how code looks like:

                ( I named the button clips c0 - left one; c1 - middle one, and c2 - right one)

                 

                Problem is, only middle one does the correct "l2-l1" tween, other two just return with trace message, but don't play suggested frame

                 

                // C1

                c1.onRollOver = function(){

                                    if(c2._currentframe != 1){

                      c2.gotoAndPlay("l2-l1");

                            trace("this should play c2.l2-l1 but doesnt !!!");

                            c1.gotoAndPlay("l1-l2");

                            c0.gotoAndPlay("n-l1");

                    }

                          else if(c0._currentframe != 1){

                          c0.gotoAndPlay("l2-l1");

                          trace("this should play c0.l2-l1 but doesnt !!!");

                          c1.gotoAndPlay("l1-l2");

                          c2.gotoAndPlay("n-l1");

                          }

                          else

                          c1.gotoAndPlay("n-l2");

                          c0.gotoAndPlay("n-l1");

                          c2.gotoAndPlay("n-l1");

                };

                c1.onRollOut = function(){

                          c1.gotoAndPlay("l2-n");

                          c0.gotoAndPlay("l1-n");

                          c2.gotoAndPlay("l1-n");

                };

                // C2

                c2.onRollOver = function(){

                 

                          if(c1._currentframe != 1){

                      c1.gotoAndPlay("l2-l1");

                            trace("this plays OK !");

                            c2.gotoAndPlay("l1-l2");

                    }

                          else

                          c1.gotoAndPlay("n-l1");

                          c2.gotoAndPlay("n-l2");

                };

                c2.onRollOut = function(){

                          c1.gotoAndPlay("l1-n");

                          c2.gotoAndPlay("l2-n");

                };

                // C0

                c0.onRollOver = function(){

                                    if(c1._currentframe != 1){

                      c1.gotoAndPlay("l2-l1");

                            c0.gotoAndPlay("l1-l2");

                    }

                          else

                          c1.gotoAndPlay("n-l1");

                          c0.gotoAndPlay("n-l2");

                };

                c0.onRollOut = function(){

                          c1.gotoAndPlay("l1-n");

                          c0.gotoAndPlay("l2-n");

                };

                 

                • 5. Re: Can't figure what's wrong in my menu rollover/rollout project
                  Atlas020 Level 1

                  I made another file from the scratch, and figured that my  if / else variable was wrong !

                   

                  instead of

                  else

                            c1.gotoAndPlay("n-l1");

                            c2.gotoAndPlay("n-l2");

                   

                  should be

                   

                  else {

                            c1.gotoAndPlay("n-l1");

                            c2.gotoAndPlay("n-l2");

                  }

                   

                  And it works !

                   

                  Thank you for helping once again.

                   

                  Edit: I reuploaded swf in the link so you can see how it works now.