Im新的动作3.0,我目前正在做一个Flash演示文稿。除了按钮之外,它全部完成,我不知道如何使用actionscript 3.0。我有很多按钮,但我需要的是使按钮(单击时)转到另一个场景并重播场景的命令。寻找动作3.0的按钮命令
感谢
Im新的动作3.0,我目前正在做一个Flash演示文稿。除了按钮之外,它全部完成,我不知道如何使用actionscript 3.0。我有很多按钮,但我需要的是使按钮(单击时)转到另一个场景并重播场景的命令。寻找动作3.0的按钮命令
感谢
如果你有在舞台上的按钮,让我们说叫button0
,则:
button0.addEventListener("click", button0Clicked);
function button0Clicked(evt:*):void
{
//do whatever you want to do here
}
还有一些其他的事件,只是改变点击mouseDown
,mouseUp
,doubleClick
,mouseOver
,mouseOut
。我认为这些类型是为自己说话的。
如果您使用DoubleClick,你必须设置doubleClickEnabled
到true
:
button0.doubleClickEnabled = true;
也确实很有必要知道:
button0.buttonMode = true;
button0.useHandCursor = true;
如果BUTTON0不是一个Button实例,但一个影片剪辑实例,当鼠标在按钮上时,您希望鼠标变成“手”。
我希望这可以帮助你更接近你的目标。
import flash.events.MouseEvent;
//use stop in the begin to avoid the repeat frames again
stop();
//here i have play button is play_mc if it click then it goes to the
function GameStart
mc.play_mc.addEventListener(MouseEvent.CLICK, GameStart);
mc.play_mc.useHandCursor = true;
mc.play_mc.buttonMode = true;
function GameStart(event:MouseEvent):void
{
//gotoAndPlay by using to go to the frame Gameplay is the frame name it
goes to that frame
gotoAndPlay("GamePlay");
}
如果您想了解更多请到这里学习http://www.adobe.com/devnet/flash/articles/accessible_animated_preso.html
请张贴代码。 – 2011-04-29 14:02:00
@ user729786是否使用文档类或时间轴? – Taurayi 2011-04-29 14:12:02