Flex: Determine if a component is showing

后端 未结 6 1417
太阳男子
太阳男子 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条回答
  •  逝去的感伤
    2021-02-20 02:49

    You want to check if the component property visible is true and this is for all the parents of your component in the DisplayList, am I correct?

    public static function isVisible(c : UIComponent) : Boolean {
        if (c == null) return false;
        if (c is Application) return c.visible;
        return c.visible && isVisible(c.parent);
    }
    

提交回复
热议问题