From 1013a04c5c9167ce81bbe7566b6303d97fe02fc0 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 12 Mar 2007 21:52:28 +0000 Subject: [PATCH] Don't rely on parentChanged(). git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@164 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flex/ChatDisplayBox.as | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/as/com/threerings/flex/ChatDisplayBox.as b/src/as/com/threerings/flex/ChatDisplayBox.as index ee2486cd..d578a54c 100644 --- a/src/as/com/threerings/flex/ChatDisplayBox.as +++ b/src/as/com/threerings/flex/ChatDisplayBox.as @@ -47,6 +47,9 @@ public class ChatDisplayBox extends TextArea // TODO width = 400; height = 150; + + addEventListener(Event.ADDED_TO_STAGE, handleAddRemove); + addEventListener(Event.REMOVED_FROM_STAGE, handleAddRemove); } // documentation inherited from interface ChatDisplay @@ -72,12 +75,11 @@ public class ChatDisplayBox extends TextArea 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(); - if (p != null) { + if (event.type == Event.ADDED_TO_STAGE) { chatdir.addChatDisplay(this); } else { chatdir.removeChatDisplay(this);