Добрый вечер!
Код AS3:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TextEvent;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.*;
[SWF(width="500", height="500")]
public class Island extends Sprite{
public function Island() {
var btnNew:myBtn = new myBtn();
addChild(btnNew);
btnNew.x = 180;
btnNew.y = 440;
btnNew.label = "обновить";
btnNew.addEventListener(MouseEvent.CLICK, pressMyBtn);
}
private function pressMyBtn(event:MouseEvent):void
{
var allSector:allSectorIsland = new allSectorIsland();
addChild(allSector);
allSector.x = 10;
allSector.y = 10;
}
}
}
вот я добавил кнопкой addChild(allSector);
как при повторном нажатии кнопки удалить старый и сразу тудаже добавить вновь посланный addChild(allSector);?
чтобы друг на друга не наслаивались