ActionScript 3 AS3:onAdded事件监听器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3:onAdded事件监听器相关的知识,希望对你有一定的参考价值。

function onAdded(e:Event):void {
    // get reference to child from event object
    // as child variable of target will not yet be defined
    var childRef:MovieClip = e.target as MovieClip;
	trace(childRef.type + " " + stage.numChildren);
   
    // check the name of the reference for correct instance name
    if (childRef && childRef.name == "child"){
        e.target.removeEventListener(Event.ADDED, onAdded);
    }
}
//stage.addEventListener(Event.ADDED, onAdded);

以上是关于ActionScript 3 AS3:onAdded事件监听器的主要内容,如果未能解决你的问题,请参考以下文章