gpt4 book ai didi

actionscript-3 - FlashDevelop语法错误: Expecting Identifier Before Public

转载 作者:行者123 更新时间:2023-12-03 08:22:11 26 4
gpt4 key购买 nike

我是AS3的新手,非常感谢您能为我提供的任何帮助!我正在尝试创建一个按钮。但是,FlashDevelop不断告诉我在以下方面存在语法错误:

  • 第11行第2列(语法错误:在公开之前需要标识符)
  • 第11行第40行(语法错误:扩展之前需要标识符)
  • 第13行第2列(错误:private属性只能用于类属性定义)

  • 下面是我的代码:
    package 
    {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.display.Graphics;
    import flash.
    /**
    * ...
    * @author 15leungjs1
    */
    public class Main extends Sprite
    {
    private var button:Sprite;

    public function Main():void
    {
    //Create a new instance of a Sprite to act as the button graphic.
    button = new Sprite();

    //Set the color of the button graphic
    button.graphics.beginFill(0xFFAD3B);

    //Set the X,Y, Width, and Height of the button graphic
    button.graphics.drawRect(10, 0, 200, 100);

    //Apply the fill
    button.graphics.endFill();

    //Add Handcursor,buttonMode, and mouseChildren
    button.buttonMode = true;
    button.useHandCursor = true;
    button.mouseChildren = false;

    //Add Button Sprite to stage
    this.addChild(button);
    }
    }
    }

    }

    最佳答案

    问题很简单...

    您有以下代码行(第6行)未正确完成:

    import flash.

    您需要完成该导入语句或将其完全删除。

    关于actionscript-3 - FlashDevelop语法错误: Expecting Identifier Before Public,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25717052/

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