考虑下面的代码:为什么我不能跟踪点击事件?
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.display.*;
[SWF(width="1000",height="600")]
public class vanCopperTes extends Sprite
{
public function vanCopperTes()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
//黄色矩形
graphics.beginFill(0xFFCC00,.5);
graphics.drawRect(0,0,200,200);
graphics.endFill();
addEventListener(MouseEvent.CLICK,onClick);
trace("this.numChilder",numChildren);// output: 0
}
private function onClick(e:MouseEvent):void
{
trace("Click");
}
}
}