You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by moushuai00 <mo...@hotmail.com> on 2013/10/17 17:36:13 UTC

How to determine the component is not visible

Hi All:

How to determine the component is not visible, When I set the container invisible, but the property of the child is visible.

<fx:Script>
<![CDATA[
import mx.controls.Alert;

protected function button1_clickHandler(event:MouseEvent):void
{
trace(container.visible); 
trace(children.visible); 
container.visible = false; 
}
protected function button2_clickHandler(event:MouseEvent):void
{
trace(container.visible); 
trace(children.visible); 
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:VGroup id="container">
<s:TextInput id="children"/>
</s:VGroup>
<s:Button x="10" y="50" label="hide" click="button1_clickHandler(event)"/>
<s:Button x="112" y="50" label="getProperty" click="button2_clickHandler(event)"/>
 




moushuai00

Re: How to determine the component is not visible

Posted by Alex Harui <ah...@adobe.com>.
You have to walk up the parent chain and check each parent.

On 10/17/13 8:36 AM, "moushuai00" <mo...@hotmail.com> wrote:

>Hi All:
>
>How to determine the component is not visible, When I set the container
>invisible, but the property of the child is visible.
>
><fx:Script>
><![CDATA[
>import mx.controls.Alert;
>
>protected function button1_clickHandler(event:MouseEvent):void
>{
>trace(container.visible);
>trace(children.visible);
>container.visible = false;
>}
>protected function button2_clickHandler(event:MouseEvent):void
>{
>trace(container.visible);
>trace(children.visible);
>}
>]]>
></fx:Script>
><fx:Declarations>
><!-- 将非可视元素(例如服务、值对象)放在此处 -->
></fx:Declarations>
><s:VGroup id="container">
><s:TextInput id="children"/>
></s:VGroup>
><s:Button x="10" y="50" label="hide" click="button1_clickHandler(event)"/>
><s:Button x="112" y="50" label="getProperty"
>click="button2_clickHandler(event)"/>
> 
>
>
>
>
>moushuai00