奇怪的Flash编译器错误

时间:2012-09-21 14:39:20

标签: actionscript-3 flash compiler-errors flash-cs5

我正在制作一个非常简单的幻灯片..我使用相同的脚本制作了其他没有错误的人。 这是一个简单的幻灯片,底部有7个按钮,可以跳转到节目中的各个点。

如果我在我的操作窗格中输入ANYTHING,则会出现以下错误,完全按照显示的方式编写:

场景1,图层'动作,第1帧,第1行1023:不兼容的覆盖。 场景1,层'动作,帧1,行1 1023:不兼容的覆盖。 场景1,层'动作,帧1,行1 1021:重复功能定义。 MainTimeline,第1行1000:对第1帧的不明确引用。

无论我在脚本中添加什么,它都会触发这些错误。即使我输入的所有内容都是基本命令,即使它如下所示被注释掉: //停止;

这是我的剧本:

import flash.events.MouseEvent;

button1.addEventListener(MouseEvent.CLICK,showpic1);
button2.addEventListener(MouseEvent.CLICK,showpic2);
button3.addEventListener(MouseEvent.CLICK,showpic3);
button4.addEventListener(MouseEvent.CLICK,showpic4);
button5.addEventListener(MouseEvent.CLICK,showpic5);
button6.addEventListener(MouseEvent.CLICK,showpic6);
button7.addEventListener(MouseEvent.CLICK,showpic7);

function showpic1(Event:MouseEvent):void{
    gotoAndPlay("picture1");
}

function showpic2(Event:MouseEvent):void{
gotoAndPlay("picture2");
}

function showpic3(Event:MouseEvent):void{
gotoAndPlay("picture3");
}

function showpic4(Event:MouseEvent):void{
gotoAndPlay("piturec4");
}

function showpic5(Event:MouseEvent):void{
gotoAndPlay("picture5");
}

function showpic6(Event:MouseEvent):void{
gotoAndPlay("picture6");
}

function showpic7(Event:MouseEvent):void{
gotoAndPlay("picture7");
}

2 个答案:

答案 0 :(得分:0)

您应该使用小写“event”在每个侦听器中命名变量。 “Event”是类名,而“event”是未使用的标识符,您可以将其用作变量。

function showpic1(event:MouseEvent):void{

答案 1 :(得分:0)

错误意味着您可能已将这些功能复制并粘贴到同一时间轴上的其他位置。当您有两个具有相同名称但不同的参数集和返回类型的函数时,会发生不兼容的覆盖。您很可能已经声明了一个使用内置函数名称的函数。重复的函数定义意味着您已经两次声明了相同的函数。模糊引用是前者的结果:但这是因为您的代码在模板中使用,其中在模板中使用它的结果产生了歧义。名称为frame#的函数由Flash CS生成,用于在帧之间导航。