简体   繁体   English

如何在Adobe Flash AS 3.0中将鼠标悬停在gotoAndPlay上

[英]How to gotoAndPlay on mouseover in Adobe Flash AS 3.0

In Adobe Flash CC As 3.0 I try to make add gotoAndPlay function on mouseover inside a scene. 在Adobe Flash CC 3.0中,我尝试在场景内的鼠标悬停时添加gotoAndPlay函数。

I put this code: 我把这段代码:

this.stop();
this.addChild(overBtn);
this.overBtn.addEventListener("mouseover", function (event)
{
        this.gotoAndPlay(17);    
});

But its not working, what am I doing wrong? 但是它不起作用,我在做什么错?

The syntax for adding an event listener is 添加事件侦听器的语法是

<target>.addEventListener(<Event>,<function>);

example

stage.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);

Then you'd have a function elsewhere like this: 然后,您将在其他地方具有以下功能:

private function mouseOver(me:MouseEvent):void{
    goToAndPlay(17);
}

for accessing handled object, inside event listener do this 用于访问处理的对象,在事件监听器中执行此操作

this.stop();
this.addChild(overBtn);
overBtn.addEventListener("mouseover", function (event)
{
        event.target.gotoAndPlay(17);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flash AS3.0-错误1180调用可能未定义的方法gotoAndPlay? - Flash AS3.0 - Error 1180 Call to a possibly undefined method gotoAndPlay? Adobe Flash。 鼠标悬停动画无限循环 - Adobe Flash. Mouseover animation endless loop ActionScript 3.0 gotoAndStop和gotoAndPlay - ActionScript 3.0 gotoAndStop and gotoAndPlay AS3(Adobe AIR / Flash)gotoAndPlay导致巨大的延迟,即使它仅被调用一次? - AS3 (Adobe AIR / Flash) gotoAndPlay causing immense lag, even though it's only being called once? Adobe Flash中的ActionScript 3.0标识符列表 - List of identifiers of ActionScript 3.0 in Adobe Flash Flash:Action Script 3.0:删除侦听器和gotoandplay框架时出现奇怪的错误 - Flash : Action Script 3.0 : strange error when removing listeners and gotoandplay frame 如何在Adobe Flash CS6 ActionScript 3.0中停止场景并播放下一个场景 - how do I stop a scene and play the next scene in adobe flash cs6 actionscript 3.0 如何使用Adobe Flash CS6 ActionScript 3.0制作触摸屏菜单(场景之间的链接按钮) - How to make a menu for touchscreen (link buttons from scene to scene) with adobe flash CS6 actionscript 3.0 按键+ gotoAndPlay(xy)Flash - Key pressed + gotoAndPlay(xy) Flash ActionScript 3.0,Adobe Flash CS6-删除孩子 - Actionscript 3.0, adobe flash cs6 - removing a child
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM