AS3互动故事选择按钮

时间:2014-05-03 04:13:29

标签: actionscript-3 events button mouse movieclip

我承认,我是AS3中的n00b。我的问题是这个。我正在制作一个互动小说,我使用movieClip作为选择按钮,因为它们提供了更多的控制。我试图让他们响应鼠标事件,以便通过转到ChoiceBtn的movieClip内的另一个框架,对用户(如高亮显示)更敏感。这是我提出的代码,flash就像它不存在一样。

ChoiceBtn1.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn1.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn1.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);

ChoiceBtn2.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn2.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn2.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);

ChoiceBtn3.addEventListener(MouseEvent.MOUSE_OVER, mouse_Over);
ChoiceBtn3.addEventListener(MouseEvent.MOUSE_DOWN, mouse_Down);
ChoiceBtn3.addEventListener(MouseEvent.MOUSE_OUT, mouse_Out);

function mouse_Over (event: MouseEvent):void 
{
    event.target.gotoAndStop(2);
}

function mouse_Down (event: MouseEvent):void 
{
    event.target.gotoAndStop(3);
}

function mouse_Out (event: MouseEvent):void 
{
    event.target.gotoAndStop(1);
}

1 个答案:

答案 0 :(得分:0)

您的代码非常好。你已经在属性面板中给出了按钮实例名称:ChoiceBtn1,ChoiceBtn2和ChoiceBtn3,对吗?你是什​​么意思“......闪光就像它不存在一样。”什么是IT?