Don't rely on parentChanged().
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@164 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -47,6 +47,9 @@ public class ChatDisplayBox extends TextArea
|
|||||||
// TODO
|
// TODO
|
||||||
width = 400;
|
width = 400;
|
||||||
height = 150;
|
height = 150;
|
||||||
|
|
||||||
|
addEventListener(Event.ADDED_TO_STAGE, handleAddRemove);
|
||||||
|
addEventListener(Event.REMOVED_FROM_STAGE, handleAddRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface ChatDisplay
|
// documentation inherited from interface ChatDisplay
|
||||||
@@ -72,12 +75,11 @@ public class ChatDisplayBox extends TextArea
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function parentChanged (p :DisplayObjectContainer) :void
|
// handle us being added or removed from the stage
|
||||||
|
protected function handleAddRemove (event :Event) :void
|
||||||
{
|
{
|
||||||
super.parentChanged(p);
|
|
||||||
|
|
||||||
var chatdir :ChatDirector = _ctx.getChatDirector();
|
var chatdir :ChatDirector = _ctx.getChatDirector();
|
||||||
if (p != null) {
|
if (event.type == Event.ADDED_TO_STAGE) {
|
||||||
chatdir.addChatDisplay(this);
|
chatdir.addChatDisplay(this);
|
||||||
} else {
|
} else {
|
||||||
chatdir.removeChatDisplay(this);
|
chatdir.removeChatDisplay(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user