goaganesha
Programmer
Hi, I’m trying to make a dropdownmenu but there seems to be something wrong with my actionscript.
Here is what I’ve done :
On scene1 there is a button with following action in the object panel :
//==========================
on (rollOver)
{
_root.submenu1.gotoAndPlay("over"
}
//==========================
The mc « submenu1 » is also on scene1
It starts with an empty frame labeled « normal » and a stop (); action
The second frame is labeled « over » and is the start of an animation which lets the submenu drop down.
The last frame is labeled « final » and contains another movieclip called « sub1total » and a stop() ; action
« sub1total » has 1 frame with a stop action and contains the different subbuttons + a fake button which covers the button on scene 1 once the menu is open.
In the objectpanel of « sub1total » I have put following code :
//==========================
onClipEvent (enterFrame)
{
bounds = this.getBounds(_root);
if ((_root.xmouse <= bounds.xMax) &&
(_root.xmouse >= bounds.xMin) &&
(_root.ymouse <= bounds.yMax) &&
(_root.ymouse >= bounds.yMin))
{
_root.submenu1.gotoAndStop("final"
}
else
{
_root.submenu1.gotoAndStop("normal"
}
}
//============================
The problem is that the if statement never seems to be true ‘cause the dropdownmenu shuts right after it was opened. If I delete the else statement the menu stays open but won’t close once the mouse leaves the submenu area. To me it seems that the if statement should be true ‘cause the « submenu1 » mc covers the button which triggers the « on (rollOver) » event on scene1, so the mouse is over the « sub1total » area.
Thanx for your help
Here is what I’ve done :
On scene1 there is a button with following action in the object panel :
//==========================
on (rollOver)
{
_root.submenu1.gotoAndPlay("over"
}
//==========================
The mc « submenu1 » is also on scene1
It starts with an empty frame labeled « normal » and a stop (); action
The second frame is labeled « over » and is the start of an animation which lets the submenu drop down.
The last frame is labeled « final » and contains another movieclip called « sub1total » and a stop() ; action
« sub1total » has 1 frame with a stop action and contains the different subbuttons + a fake button which covers the button on scene 1 once the menu is open.
In the objectpanel of « sub1total » I have put following code :
//==========================
onClipEvent (enterFrame)
{
bounds = this.getBounds(_root);
if ((_root.xmouse <= bounds.xMax) &&
(_root.xmouse >= bounds.xMin) &&
(_root.ymouse <= bounds.yMax) &&
(_root.ymouse >= bounds.yMin))
{
_root.submenu1.gotoAndStop("final"
}
else
{
_root.submenu1.gotoAndStop("normal"
}
}
//============================
The problem is that the if statement never seems to be true ‘cause the dropdownmenu shuts right after it was opened. If I delete the else statement the menu stays open but won’t close once the mouse leaves the submenu area. To me it seems that the if statement should be true ‘cause the « submenu1 » mc covers the button which triggers the « on (rollOver) » event on scene1, so the mouse is over the « sub1total » area.
Thanx for your help