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:
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();
};
- 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();
- };
Greatly appreciate any help
