Flash quirks: SimpleButton can be a DisplayObject.parent

While developing a custom cursor class I came across the following quirk.

One of the things the custom cursor class does is checking if mouseChildren of all parent DisplayObjectContainer instances are enabled.

It retrieves the current objects under the mouse via this.stage.getObjectsUnderPoint and recursively processes the parent properties till the stage instance is reached.

The quirk happens when you mouse over a SimpleButton on the stage which might contain Shape and TextField instances. The parent property of those will be set to SimpleButton instance. The problem is that SimpleButton is not a DisplayObjectContainer subclass, but instead is a subclass of InteractiveObject. So there is no mouseChildren property to access.

With my current Flash and Firefox versions, trying to access this property resulted in the Flash player plugin crashing within FireFox.

To prevent this, check first if the parent is indeed a DisplayObjectContainer instance.