Flash CS3鼠标事件

时间:2012-09-19 09:47:48

标签: actionscript-3

每当鼠标离开按钮时,我想让menubar.handmove可见。 但是,当我查看/单击按钮时,可见性将为false,但是当我将鼠标移到按钮时,它将不会返回true。

我该怎么办?

stop();

menubar.play_but.addEventListener(MouseEvent.CLICK, playgame);
menubar.intr_but.addEventListener(MouseEvent.MOUSE_OVER, overdown1);
menubar.play_but.addEventListener(MouseEvent.MOUSE_OVER, overdown);
menubar.intr_but.addEventListener(MouseEvent.CLICK, instruc);
stage.addEventListener(MouseEvent.MOUSE_MOVE, menu);

var mouseE:Boolean = false;

function playgame(e:MouseEvent):void {
gotoAndPlay(63);
mouseE=true;
}

function overdown(e:MouseEvent):void {
 mouseE=true;
}

function instruc(e:MouseEvent):void {
gotoAndPlay(64);
mouseE=true;
}

function overdown1(e:MouseEvent):void {
mouseE=true;
}

function menu(e:MouseEvent):void {

if(mouseE==false;){
menubar.handmove.visible=true;
}else{
menubar.handmove.visible=false;
}
}

1 个答案:

答案 0 :(得分:0)

您应该将此代码添加到现有代码中:

menubar.intr_but.addEventListener(MouseEvent.MOUSE_OUT, moveout);
menubar.play_but.addEventListener(MouseEvent.MOUSE_OUT, moveout);

function moveout(e:MouseEvent):void {
    mouseE=false;
}

同时删除字符;以便成功编译。必须是:

if(mouseE==false){