Я знаю, что «это» отличается как снаружи, так и внутри крышки.
Но почему numChildren и this.numChildren отличается внутри закрытия?
Или почему numChildren одинаково снаружи и внутри?Ключевое слово 'this' внутри укупорочного средства
var _this:Sprite = this;
trace("[outside]this: " + this);
trace("[outside]numChildren: " + numChildren);
trace("[outside]this.numChildren: " + this.numChildren);
(function():void {
trace("[inside]this: " + this);
trace("[inside]numChildren: " + numChildren);
trace("[inside]this.numChildren: " + this.numChildren);
trace(_this.removeChildAt === removeChildAt);
trace(this.removeChildAt === removeChildAt);
})();
Вы можете увидеть код и выход по следующей ссылке
How Do You Explain 'this'?
Спасибо за объяснение детали! – 9re