语法错误:在此之前需要标识符。在离开之前期待结肠。在rightbrace之前期待标识符

时间:2015-10-28 12:36:24

标签: actionscript-3 flash syntax-error

Scene 1, Layer 'script', Frame 1, Line 9    1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 9    1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 10   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 16   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 16   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 17   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 23   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 23   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 24   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 30   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 30   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 31   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 37   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 37   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 38   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 44   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 44   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 45   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 51   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 51   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 52   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 58   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 58   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 59   1084: Syntax error: expecting identifier before rightbrace.
Scene 1, Layer 'script', Frame 1, Line 65   1084: Syntax error: expecting identifier before this.
Scene 1, Layer 'script', Frame 1, Line 65   1084: Syntax error: expecting colon before leftparen.
Scene 1, Layer 'script', Frame 1, Line 66   1084: Syntax error: expecting identifier before rightbrace.

这些错误(其中27个)出现,我的停止命令不起作用,我的代码有什么问题?我是flash动作脚本的新手,我使用youtube教程来创建我所参考的按钮(knapp)。

这是我的代码

stop();

//knappane til dei forskjellige planetane

//solen
solenKnappen.addEventListener(MouseEvent.CLICK, goToSolen);

function goToSolen(event: MouseEvent);void {
this.gotoAndStop("solen")
}

//merkur
merkurKnappen.addEventListener(MouseEvent.CLICK, goToMerkur);

function goToMerkur(event: MouseEvent);void {
this.gotoAndStop("merkur")
}

//venus
venusKnappen.addEventListener(MouseEvent.CLICK, goToVenus);

function goToVenus(event: MouseEvent);void {
this.gotoAndStop("venus")
}

//jorden
jordenKnappen.addEventListener(MouseEvent.CLICK, goToJorden);

function goToJorden(event: MouseEvent);void {
this.gotoAndStop("jorden")
}

//mars
marsKnappen.addEventListener(MouseEvent.CLICK, goToMars);

function goToMars(event: MouseEvent);void {
this.gotoAndStop("mars")
}

//jupiter
jupiterKnappen.addEventListener(MouseEvent.CLICK, goToJupiter);

function goToJupiter(event: MouseEvent);void {
this.gotoAndStop("jupiter")
}

//saturn
saturnKnappen.addEventListener(MouseEvent.CLICK, goToSaturn);

function goToSaturn(event: MouseEvent);void {
this.gotoAndStop("saturn")
}

//uranus
uranusKnappen.addEventListener(MouseEvent.CLICK, goToUranus);

function goToUranus(event: MouseEvent);void {
this.gotoAndStop("uranus")
}

//neptun
neptunKnappen.addEventListener(MouseEvent.CLICK, goToNeptun);

function goToNeptun(event: MouseEvent);void {
this.gotoAndStop("neptun")

1 个答案:

答案 0 :(得分:1)

您的代码错误是指使用分号;)来表示您的功能类型,而不是使用冒号({ {1}}),因此您的:函数的代码应该是这样的:

goToSolen()

当然,你应该完成所有功能。

有关ActionScript 3中函数的更多信息,请查看here

希望可以提供帮助。