function onclick(e:MouseEvent){//事件的动作
mc.gotoAndStop(1,"A")//跳转到场景A的第一帧,mc为要跳转的元件
}
播放 flash动画么?我也是菜鸟!我的步骤是这样的:
从组件面板把 2个Button 拖到舞台上,位置自定义。然后2个Button的实例名称分别为:
play_btn(开始按钮),rep_btn(重播按钮);然后新建一个名为“action”的层, 在层的
第一帧按F9 进入代码面板,要输入的代码如下:
stop()
play_btn.addEventListener(MouseEvent.CLICK,play)
rep_btn.addEventListener(MouseEvent.CLICK,rep)
function play(e:MouseEvent):void{
play()
}
function rep(e:MouseEvent):void{
gotoAndPlay(1)
}
as3.0中的代码只能加在帧里面。在场景中放一个按钮mybutton.选中它之后点击属性,最上面有个文本框,鼠标放上去会有工具提示“实例名称”(flash
cs5.5),在其中写mybutton,就是实例名了。再打开时间轴,选中第一帧,点右键打开动作面板,键入以下代码:
mybutton.addeventlistener(mouseevent.click,mybuttoneventhandler)
function
mybuttoneventhandler(event:mouseevent):void
{
trace("你点击了mybutton.")
//mytimer.start()//启动定时器请自已设置;
}
//正在做任务,请及时采纳最佳,谢谢。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)