2 Replies Latest reply on Sep 16, 2009 7:53 PM by shintashi

    Hi-lighting drop down menu options?

    shintashi Level 1

      I'm having some trouble with drop down menus. I've got them set up with onrollover to display the menu options and use both rollout & dragout to deactivate (which prevents the menu from sticking by accidentally "dragging" off the area).

       

      The menu displays just fine, and I want the background of the options to highlight (by switching color) when the mouse moves over it or presses on it. Unfortunately, nothing happens.

       

      I used this as my base color switch

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

      function paint(mc, brush){
          var fincolor = brush;
      myColor = new Color(mc);
      myColor.setRGB(fincolor);
      }

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

       

      this for my basic menu drop (note: my main menu name is "pl"; menu list names: L1 through L6).

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

      function pk(movie){movie.onRollOver = function(){movie.gotoAndStop(2);}
          }   
      function rk(movie){movie.onDragOut = movie.onRollOut = function(){movie.gotoAndStop(1);}
          }

       

      onEnterFrame = function(){

       

      pk(pl.L1); rk(pl.L1);
      pk(pl.L2); rk(pl.L2); //activate/deactivate by roll over;
      pk(pl.L3); rk(pl.L3);
      pk(pl.L4); rk(pl.L4);
      pk(pl.L5); rk(pl.L5);
      pk(pl.L6); rk(pl.L6);

       

       

      }

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

       

      So the menu thing works fine, but when I try to add a hi-light option using the color function,

       

      //hl = hilight, LL = lowlight;

      function hl(movie){movie.onRollOver = function(){ paint(movie, "0xFFFFFF");}
          }    //needs second command for main "archive/story load" to load news articles in/to whitespace
      function LL(movie){movie.onDragOut = movie.onRollOut = function(){ paint(movie, "0x000033");}
          }

       

      and stick something like

      hl(pl.L2.submenu1); LL(pl.L2.submenu1);

       

      inside the onEnterFrame (or outside it for that matter), nothing happens - the colors don't change. But I know the color thing works if I only

      apply it to the visible menu, such as

       

      hl(pl.L2); LL(pl.L2);

       

      ...

       

      Is there some kind of interference going on? Should I be using something drastically simpler to hi-light or detect clicking?

        • 1. Re: Attempt at Simplification
          shintashi Level 1

          Same concept, different code:

           

          base.onRollOver = function(){base.gotoAndStop(2);}
          base.onRollOut = function(){base.gotoAndStop(1);}

           


          base.bar.onRollOver = function(){bar.rotation += 15;}
          base.bar.onRollOut = function(){bar.rotation = 0;}

           

          (note: bar is located on frame 2 of base)

          That's basically the same idea, a movie clip inside a movie clip does not respond to onRollOver if the reason it is open is because of onRollOver. How do I troubleshoot this limitation?

          • 2. Re: Attempt at Simplification
            shintashi Level 1

            Found a Work Around using mouse as a hitTest:

             

            function paint(mc, brush){
                var fincolor = brush;
            myColor = new Color(mc);
            myColor.setRGB(fincolor);
            }

             

            function sense(menu_item){
            if(menu_item.hitTest(_root._xmouse, _root._ymouse, true)){paint(menu_item, "0xFFFFFF");}
            else{paint(menu_item, "0x000033");}
                }

             

            base.onRollOver = function(){base.gotoAndStop(2);}
            base.onRollOut = function(){base.gotoAndStop(1);}

             


            onEnterFrame = function(){

             

                sense(base.bar);
            }

             

             

            I don't know if this type of code will work with the main Document, so i'm posting this in case I'm missing something.