我是AS3的新手,如果您能给我任何帮助,我将不胜感激!我正在尝试创建一个按钮。然而,FlashDevelop一直告诉我我在中有语法错误
- 第11行第2列(语法错误:公共之前应为标识符)
- 第11行第40列(语法错误:扩展前应为标识符)
- 第13行第2列(错误:私有属性只能用于类属性定义)
以下是我的代码:
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.
您需要完成导入语句或将其完全删除。