From fdd29ccb249727d86e4c06ef21766d7b57a5af74 Mon Sep 17 00:00:00 2001 From: Chris Speciale Date: Wed, 10 Jul 2024 08:10:28 -0400 Subject: [PATCH] DisplayObjectContainer: Minor fixes More invalid casting. It would be nice if we could cast and just get a null value if it was incompat. --- src/starling/display/DisplayObjectContainer.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/starling/display/DisplayObjectContainer.hx b/src/starling/display/DisplayObjectContainer.hx index 1a978aed..7e44c2d5 100644 --- a/src/starling/display/DisplayObjectContainer.hx +++ b/src/starling/display/DisplayObjectContainer.hx @@ -209,7 +209,7 @@ class DisplayObjectContainer extends DisplayObject { // If the child is on the stage, dispatch the REMOVED_FROM_STAGE event if (stage != null) { - var container:DisplayObjectContainer = (child : DisplayObjectContainer); + var container:DisplayObjectContainer = Std.isOfType(child, DisplayObjectContainer) ? cast child : null; if (container != null) { container.broadcastEventWith(Event.REMOVED_FROM_STAGE); } else { @@ -649,8 +649,8 @@ class DisplayObjectContainer extends DisplayObject { if (object.hasEventListener(eventType)) { listeners[listeners.length] = object; // avoiding 'push' } - - var container:DisplayObjectContainer = (object : DisplayObjectContainer); + + var container:DisplayObjectContainer = Std.isOfType(object, DisplayObjectContainer) ? cast object : null; if (container != null) { var children:Array = container.__children;