drop down rollOut

  • meAsking
  • Beginner
  • Beginner
  • meAsking
  • Posts: 38

Post 3+ Months Ago

Hello,

I'm trying to create a drop down menu.
I have horizontal MCs for top menu items, and vertical MCs under each of the top MCs.
When you roll out of top MC the vertical menu underneath it disappears, but how do i get it to stay if you move your mouse downwards to hover over this vertical menu?
I'm trying to use hitTest to detect where the mouse is, but it doesn't return anything with the way i code it. Is hitTest the right way to go? if yes, why doesn't it work for me?

Here's my code:
Code: [ Select ]
var menu1items = 4;
generateMenu = function () {
    var curr_item;
    var curr_menu:MovieClip = this.createEmptyMovieClip("menu1", 1);
    for (var i = 0; i<menu1items; i++) {
        curr_item = curr_menu.attachMovie("mc"+i, "mcIn"+i, i);
        a = menu1["mcIn"+i];
        curr_item._x = 130;
        curr_item._y = 125+i*curr_item._height;
        if (a.hitTest(_root._xmouse, _root._ymouse, true)) {
            trace("hover hittest");
        }
        a.onRelease = function() {
            trace(this);
            //closeMenu();
        };
        
    }

};
phones.onRollOver = function() {
    generateMenu();
};
phones.onRollOut = function(){
closeMenu();
}
closeMenu = function () {
    menu1.removeMovieClip();
};
  1. var menu1items = 4;
  2. generateMenu = function () {
  3.     var curr_item;
  4.     var curr_menu:MovieClip = this.createEmptyMovieClip("menu1", 1);
  5.     for (var i = 0; i<menu1items; i++) {
  6.         curr_item = curr_menu.attachMovie("mc"+i, "mcIn"+i, i);
  7.         a = menu1["mcIn"+i];
  8.         curr_item._x = 130;
  9.         curr_item._y = 125+i*curr_item._height;
  10.         if (a.hitTest(_root._xmouse, _root._ymouse, true)) {
  11.             trace("hover hittest");
  12.         }
  13.         a.onRelease = function() {
  14.             trace(this);
  15.             //closeMenu();
  16.         };
  17.         
  18.     }
  19. };
  20. phones.onRollOver = function() {
  21.     generateMenu();
  22. };
  23. phones.onRollOut = function(){
  24. closeMenu();
  25. }
  26. closeMenu = function () {
  27.     menu1.removeMovieClip();
  28. };


Greatly appreciate any help :)

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 8 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.