gpt4 book ai didi

actionscript-3 - 八哥/AS3 - 1084 : Syntax error: expecting leftbrace before leftparen

转载 作者:行者123 更新时间:2023-12-04 06:38:55 26 4
gpt4 key购买 nike

老实说,我看不出我错过了什么!一切都加起来,但似乎我的公共(public)课 GameBackground 没有正确关闭,请帮忙!我一定是盯着这个看了很久,看不清眼前是什么!

package  com./////./////.objects
{
import starling.display.Sprite;
import starling.events.Event;

public class GameBackground extends Sprite
(

private var bgLayer1:BgLayer;
private var bgLayer2:BgLayer;
private var bgLayer3:BgLayer;
private var bgLayer4:BgLayer;

private var _speed:Number = 0;


public function GameBackground()
{

super();

this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

}


private function onAddedToStage(event:Event):void
{

this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

bgLayer1 = new BgLayer(1);
bgLayer1.parallax = 0.02;
this.addChild(bgLayer1);

bgLayer2 = new BgLayer(2);
bgLayer2.parallax = 0.2;
this.addChild(bgLayer2);

bgLayer3 = new BgLayer(3);
bgLayer3.parallax = 0.5;
this.addChild(bgLayer3);

bgLayer4 = new BgLayer(4);
bgLayer4.parallax = 1;
this.addChild(bgLayer4);

this.addEventListener(Event.ENTER_FRAME, onEnterFrame);

}

private function onEnterFrame(event:Event):void
{
bgLayer1.x -= Math.ceil(_speed * bgLayer1.parallax);
if(bgLayer1 < -stage.stageWidth)
{
bgLayer1.x = 0;
}
bgLayer2.x -= Math.ceil(_speed * bgLayer2.parallax);
if(bgLayer2 < -stage.stageWidth)
{
bgLayer2.x = 0;
}
bgLayer3.x -= Math.ceil(_speed * bgLayer3.parallax);
if(bgLayer3 < -stage.stageWidth)
{
bgLayer3.x = 0;
}
bgLayer4.x -= Math.ceil(_speed * bgLayer4.parallax);
if(bgLayer4 < -stage.stageWidth)
{
bgLayer4.x = 0;
}
}

public function get speed():Number
{
return _speed;
}

public function set speed(value:Number):void
{
_speed = value;
}
}
}

最佳答案

在您的类声明下,您有一个圆括号而不是方括号。启用“允许调试”以获取行号和其他有用信息

关于actionscript-3 - 八哥/AS3 - 1084 : Syntax error: expecting leftbrace before leftparen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42637388/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com