AS3如何返回父级的其中一帧
答案:2 悬赏:0
解决时间 2021-01-13 07:50
- 提问者网友:不爱我么
- 2021-01-13 03:43
AS3如何返回父级的其中一帧
最佳答案
- 二级知识专家网友:一秋
- 2021-01-13 03:53
在mc2的帧上写如下代码:
closeA.addEventListener(MouseEvent.CLICK, gotoFrameA);
function gotoFrameA(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(5);
}
closeB.addEventListener(MouseEvent.CLICK, gotoFramB);
function gotoFrameB(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(7);
}
closeC.addEventListener(MouseEvent.CLICK, gotoFrameC);
function gotoFrameA(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(10);
}
closeA.addEventListener(MouseEvent.CLICK, gotoFrameA);
function gotoFrameA(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(5);
}
closeB.addEventListener(MouseEvent.CLICK, gotoFramB);
function gotoFrameB(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(7);
}
closeC.addEventListener(MouseEvent.CLICK, gotoFrameC);
function gotoFrameA(evt:MouseEvent):void{
MovieClip(this.parent).gotoAndStop(10);
}
全部回答
- 1楼网友:笑迎怀羞
- 2021-01-13 04:50
在mc2的任意一个图层的第一帧中添加如下代码:
closeA.addEventListener(MouseEvent.CLICK, gotoFrame); //给三个按钮添加监听事件
closeB.addEventListener(MouseEvent.CLICK, gotoFrame); //响应事件为鼠标点击
closeC.addEventListener(MouseEvent.CLICK, gotoFrame); //响应函数为gotoFrame
function gotoFrame(event:MouseEvent):void
{
if(event.currentTarget === closeA) //判断当前事件对象是否全等与 closeA 按钮
{
this.parent)gotoAndStop(5);
}
else if(event.currentTarget === closeB)
{
this.parent)gotoAndStop(7);
}
else if(event.currentTarget === closeC)
{
this.parent)gotoAndStop(10);
}
}
closeA.addEventListener(MouseEvent.CLICK, gotoFrame); //给三个按钮添加监听事件
closeB.addEventListener(MouseEvent.CLICK, gotoFrame); //响应事件为鼠标点击
closeC.addEventListener(MouseEvent.CLICK, gotoFrame); //响应函数为gotoFrame
function gotoFrame(event:MouseEvent):void
{
if(event.currentTarget === closeA) //判断当前事件对象是否全等与 closeA 按钮
{
this.parent)gotoAndStop(5);
}
else if(event.currentTarget === closeB)
{
this.parent)gotoAndStop(7);
}
else if(event.currentTarget === closeC)
{
this.parent)gotoAndStop(10);
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息