if (!stage)
{
trace(("被加载->this.parent:" + this.parent));
}else
{
trace(("单独打开->this.parent:" + this.parent));
this.addEventListener(Event.ADDED_TO_STAGE,addStage);
}

如果库里面就没必要做上面的判断,因为不管被加载还是自身打开,他都只触发是否被添加到舞台,所以直接添加

addEventListener(Event.ADDED_TO_STAGE, onAdd);

private function onAdd(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAdd); }

  

05-02 21:06