I'm new to AS3, and I would really appreciate any help you can give me! I am trying to create a button. However, FlashDevelop keeps telling me I have a Syntax Error in:
- Line 11 Col. 2 (Syntax Error: expecting identifier before public)
- Line 11 Col. 40 (Syntax Error: expecting identifier before extends)
- Line 13 Col. 2 (Error: the private attribute may only be used on class property definitions)
Below is my code:
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);
}
}
}
}