Actionscript 3 鼠标悬停时播放电影剪辑的一帧

Actionscript 3 鼠标悬停时播放电影剪辑的一帧,actionscript-3,flash,mouseevent,mouseover,Actionscript 3,Flash,Mouseevent,Mouseover,我有一张不同国家的地图。当我在其中一个国家上空盘旋时,我希望它播放电影剪辑的某一帧。我为每个国家制作了一个电影剪辑,有两帧。1。相框就是这个国家的图片,就像它出现在地图上一样。第二帧是上面有名字的国家。第二帧包含一个stop();这是我的密码: rømskog.addEventListener(MouseEvent.MOUSE_OVER,mover); halden.addEventListener(MouseEvent.MOUSE_OVER,mover); askim.addEventList

我有一张不同国家的地图。当我在其中一个国家上空盘旋时,我希望它播放电影剪辑的某一帧。我为每个国家制作了一个电影剪辑,有两帧。1。相框就是这个国家的图片,就像它出现在地图上一样。第二帧是上面有名字的国家。第二帧包含一个stop();这是我的密码:

rømskog.addEventListener(MouseEvent.MOUSE_OVER,mover);
halden.addEventListener(MouseEvent.MOUSE_OVER,mover);
askim.addEventListener(MouseEvent.MOUSE_OVER,mover);
rømskog.addEventListener(MouseEvent.MOUSE_OUT,outer);
halden.addEventListener(MouseEvent.MOUSE_OUT,outer);
askim.addEventListener(MouseEvent.MOUSE_OUT,outer);

function mover(e:MouseEvent):void {
   gotoAndPlay(2);
}

function outer(e:MouseEvent):void {
   gotoAndPlay(1);
}

我知道这段代码不正确,但我正在努力解决这个问题。我的movieclip也会自动启动,因为从一开始就可以看到国家的名称。如果有人能以最简单的方式学习我,我会非常高兴

您当前的代码将在主时间线上执行
gotoAndPlay
。您需要使乡村电影剪辑时间线转到相应的帧

您只需修改两个函数,如下所示:

function mover(e:MouseEvent):void {
   //e.currentTarget is a reference to the object that was clicked.  To avoid a compiler warning, we tell flash it's a movie clip.
   MovieClip(e.currentTarget).gotoAndStop(2); //if you don't want to actually play the timeline, use gotoAndStop
}

function outer(e:MouseEvent):void {
   //since this code is in the main timeline, doing gotoAndPlay will apply to it, not the object clicked

   //so like above, we tell the current target of the event to gotoAndPlay
   MovieClip(e.currentTarget).gotoAndStop(1);
}

主时间线,正确。你想看电影吗?如何,以什么文件格式?谢谢你的帮助!我不确定鼠标移过来和鼠标移出是否在做我想做的事情。我希望第2帧被隐藏,直到我选择将鼠标放在它上面。现在它是可见的,直到我把鼠标放在它上面,如果我把鼠标移到它上面,它就会闪烁。你有
stop()吗在您所在国家/地区的第1帧上?你说眨眼是什么意思?请确保您所在的国家有一个用于鼠标悬停的良好实心区域,如果需要,请创建一个透明背景以帮助定义鼠标悬停区域。我成功地修复了它,因此我的程序按预期工作。多谢各位