표시 객체가 제거되지 않는 이유를 알 수 없습니다. 내가 버튼을 누를 때, 나는 모두 모양과 버튼의 추적 및 제거를 기대하고 있습니다 만, 아무 반응이 없습니다 :Actionscript 표시 객체 제거
import fl.controls.Button;
var shape1:Shape = new Shape();
shape1.name = "Shape1";
shape1.graphics.lineStyle(4, 0x000000);
shape1.graphics.beginFill(0x000055, 0.5);
shape1.graphics.drawRoundRect(50, 50, 100, 75, 20, 30);
shape1.graphics.endFill();
addChild(shape1);
var shape2:Shape = new Shape();
shape2.name = "Shape2";
shape2.graphics.lineStyle(4, 0xFFFF99);
shape2.graphics.beginFill(0x550000, 0.5);
shape2.graphics.drawRoundRect(100, 75, 200, 175, 50, 10);
shape2.graphics.endFill();
addChild(shape2);
button1.addEventListener(MouseEvent.CLICK, pushButton);
function pushButton(evt:MouseEvent):void
{
for(var amount:int = numChildren; amount == 0; amount--)
{
trace(amount);
var disObj:DisplayObject = getChildAt(amount);
trace("Removing " + disObj.name);
removeChildAt(amount);
}
}
난이 달성의 더 나은 방법이 실현,하지만 난 학습 따라서 만 해요 왜 위의 코드가 작동하지 않는지에 관심이 있습니다.
감사합니다. – TheDarkIn1978