flash as3中出现场景 1, 图层'代码', 帧 1,11 行 1021: 函数定义重复。 怎么回事?
我设置四个按钮分别是MC1,MC2,MC3,MC4.分别控制帧之间的跳转。具体代码this.MC1.addEventListener(MouseEvent.CLICK,o...
我设置四个按钮分别是MC1,MC2,MC3,MC4.分别控制帧之间的跳转。具体代码
this.MC1.addEventListener(MouseEvent.CLICK,onclick);
function onclick(e:MouseEvent){
this.gotoAndPlay(130);}
this.MC2.addEventListener(MouseEvent.CLICK,onclick);
function onclick(a:MouseEvent){
this.gotoAndPlay(25);}
this.MC3.addEventListener(MouseEvent.CLICK,onclick);
function onclick(b:MouseEvent){
this.gotoAndPlay(60);}
this.MC4.addEventListener(MouseEvent.CLICK,onclick);
function onclick(c:MouseEvent){
this.gotoAndPlay(95);}
当代码为this.MC1.addEventListener(MouseEvent.CLICK,onclick);
function onclick(e:MouseEvent){
this.gotoAndPlay(130);}
还没出错,但是加上后面的就错了,不知道怎么回事。 展开
this.MC1.addEventListener(MouseEvent.CLICK,onclick);
function onclick(e:MouseEvent){
this.gotoAndPlay(130);}
this.MC2.addEventListener(MouseEvent.CLICK,onclick);
function onclick(a:MouseEvent){
this.gotoAndPlay(25);}
this.MC3.addEventListener(MouseEvent.CLICK,onclick);
function onclick(b:MouseEvent){
this.gotoAndPlay(60);}
this.MC4.addEventListener(MouseEvent.CLICK,onclick);
function onclick(c:MouseEvent){
this.gotoAndPlay(95);}
当代码为this.MC1.addEventListener(MouseEvent.CLICK,onclick);
function onclick(e:MouseEvent){
this.gotoAndPlay(130);}
还没出错,但是加上后面的就错了,不知道怎么回事。 展开
展开全部
这个其实很好理解,function你写了一堆相同名称的函数,都是function onclick(){},这样是不成的,建议你this.MC1.addEventListener(MouseEvent.CLICK,onclick1);
function onclick1(e:MouseEvent){
this.gotoAndPlay(130);}
this.MC2.addEventListener(MouseEvent.CLICK,onclick2);
function onclick2(a:MouseEvent){
this.gotoAndPlay(25);}
this.MC3.addEventListener(MouseEvent.CLICK,onclick3);
function onclick3(b:MouseEvent){
this.gotoAndPlay(60);}
this.MC4.addEventListener(MouseEvent.CLICK,onclick4);
function onclick4(c:MouseEvent){
this.gotoAndPlay(95);}
function onclick1(e:MouseEvent){
this.gotoAndPlay(130);}
this.MC2.addEventListener(MouseEvent.CLICK,onclick2);
function onclick2(a:MouseEvent){
this.gotoAndPlay(25);}
this.MC3.addEventListener(MouseEvent.CLICK,onclick3);
function onclick3(b:MouseEvent){
this.gotoAndPlay(60);}
this.MC4.addEventListener(MouseEvent.CLICK,onclick4);
function onclick4(c:MouseEvent){
this.gotoAndPlay(95);}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询