0
私のステージからいくつかのTextfieldを作成して後で削除しようとしています。ループ内のTextFieldを削除する
for(i=0;i<Chars.length;i++){
temp = Chars[i] + "_Label";
_root.createTextField(temp, _root.getNextHighestDepth(), 40, 80+(i*30), 200, 20);
this[temp].html = true;
this[temp].vScrollPolicy = false;
this[temp].selectable = false;
this[temp].styleSheet=Stat_style;
this[temp].htmlText = "<h4>" + eval(Mares[i] + ".Name") + "</h4>";
temp = Chars[i] + "_Health";
_root.createTextField(temp, _root.getNextHighestDepth(), 250, 80+(i*30), 200, 20);
this[temp].html = true;
this[temp].vScrollPolicy = false;
this[temp].selectable = false;
this[temp].styleSheet=Stat_style;
this[temp].htmlText = "<h4>" + eval(Mares[i] + ".Health") + "</h4>";
}
stop();
CTRL_Back.onRelease = function() {
for(i=0;i<Chars.length;i++){
temp = Chars[i] + "_Label";
this[temp].removeTextField();
temp = Chars[i] + "_Health";
this[temp].removeTextField();
}
}
作成パーツはうまく動作します。しかし、私はそれらを削除することはできません。 Char1_Label.removeTextField();
によって手動で試してみると動作しますが、なぜ私のループ内で動作しないのか分かりません。