问题描述:

I tried to add a 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);

But it is nowhere to be found. Any help?

网友答案:

A SimpleButton needs DisplayObjects (Sprites, for instance) in its constructor. If you don't specify any, it will not have anything to show.

from the manual:

SimpleButton(upState:DisplayObject = null, overState:DisplayObject = null, downState:DisplayObject = null, hitTestState:DisplayObject = null)
相关阅读:
Top