我尝试添加SimpleButton
...
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var btn:SimpleButton = new SimpleButton();
this.addChild(btn);
但无处可寻。有什么帮助吗?
答案 0 :(得分:2)
SimpleButton在其构造函数中需要DisplayObjects(例如Sprite)。如果您未指定任何内容,则无法显示任何内容。
来自手册:
SimpleButton(upState:DisplayObject = null, overState:DisplayObject = null, downState:DisplayObject = null, hitTestState:DisplayObject = null)