0

基本上我有一个滚动的州列表,一旦光标在它上面,我希望一个城镇列表出现在该州旁边。

我尝试让每个州名成为一个按钮,然后转到 Over 框架并在那里添加城镇列表,但是当城镇不可见时,光标会选择城镇,并且所有城镇列表都会出现。

有没有更聪明的方法来解决这个问题?

4

1 回答 1

0

Since you are not showing us any code, I still can help but it will be a little harder, what you need to do is something like this:

myStateButton.addEventListener(MouseEvent.MOUSE_OVER, enableTowns);

function disableTowns($event:MouseEvent):void {
   $event.target.removeEventListener(MouseEvent.MOUSE_OUT, disableTowns);
   $event.target.addEventListener(MouseEvent.MOUSE_OVER, enableTowns);
   myTownsSubmenu.mouseEnabled = false;
}

function enableTowns($event:MouseEvent):void {
   $event.target.removeEventListener(MouseEvent.MOUSE_OVER, enableTowns);
   $event.target.addEventListener(MouseEvent.MOUSE_OUT, disableTowns);
   myTownsSubmenu.mouseEnabled = true;
}

What all this code does is first add a trigger on the button so when you move your cursor over it, this will execute the enableTowns function which is going to enable mouse focusing on the sub-buttons, when you move out this will disable the mouse focus on these buttons, it's important you nest this sprites or movieclips correctly.

Main Button -> Sub Buttons

于 2013-05-24T18:35:06.510 回答