我希望在元素onmouseover
上触发A
事件时显示滚动条。
动作脚本3是如何完成的?
答案 0 :(得分:3)
这个解释:
代码:
import flash.events.MouseEvent;
toggleScrollbar(new MouseEvent(MouseEvent.ROLL_OUT));
spriteA.addEventListener(MouseEvent.ROLL_OVER, toggleScrollbar);
spriteA.buttonMode = true;
//and if needed:
spriteA.addEventListener(MouseEvent.ROLL_OUT, toggleScrollbar);
private function toggleScrollbar(e:MouseEvent):void
{
switch(e.type)
{
case "rollover":
scrollbar.visible = true;
break;
case "rollout":
scrollbar.visible = false;
break;
default:
break;
}
}
答案 1 :(得分:0)
A.addEventListener(MouseEvent.MOUSE_OVER, showScrollbar);
A.addEventListener(MouseEvent.MOUSE_OUT, hideScrollbar);
function showScrollbar(e:MouseEvent):void
{
//make the scrollbar visible
}
function hideScrollbar(e:MouseEvent):void
{
//hide the scrollbar again
}