オブジェクトが確実にステージから削除されたかどうかを検出したい。ここや他の場所で多くの回答を確認しましたが、オブジェクトが実際にステージから削除されたことに気付く方法がわかりません (ステージに表示されなくなったことを意味します)。以下のコードは私の最後のテストです:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Canvas width="100%" height="50%" backgroundColor="gray" id="c1">
<mx:Canvas id="cChild" backgroundColor="black" width="20" height="20"
left="20" top="20"
removedFromStage="trace('removed from stage ' + event.target)"
removed="trace('removed ' + event.target)">
</mx:Canvas>
</mx:Canvas>
<mx:Canvas width="100%" height="50%" backgroundColor="white" id="c2">
</mx:Canvas>
<mx:Button label="add child" click="c2.addChild(c1)" />
<mx:Button label="add child2" click="addChild(c1)" />
</mx:Application>
コンソール出力で見つけたものがわかりません:
removed MainFlex0.c1.cChild.border
- before click 'add child'
removed from stage MainFlex0.c1.cChild
removed MainFlex0.c2.c1.cChild.border
- after click 'add child', before 'add child2'
removed from stage MainFlex0.c2.c1.cChild
removed MainFlex0.c1.cChild.border
- after click 'add child2'
オブジェクトが本当に「ステージから削除されようとしている」ことを確認して確認できる条件はありますか?
サラム