Flex: Determine if a component is showing

后端 未结 6 1432
太阳男子
太阳男子 2021-02-20 02:42

What is the best way to determine if a component in Flex/Flash is showing on the user\'s screen? I\'m looking for an analog to Java\'s Component.isShowing() method.

The

6条回答
  •  萌比男神i
    2021-02-20 03:16

    ... or avoiding recursion:

    public static function isVisible(obj:DisplayObject):Boolean
    {
        while (obj && obj.visible && obj !== Application.application)
        {
            obj = obj.parent;
        }
        return obj && obj.visible;
    }
    

提交回复
热议问题