简体   繁体   English

Flex mobile Turning tabBar visible = True / False?

[英]Flex mobile Turning tabBar visible = True/False?

i try to toggle tabBarvisible = true/false with the following code: 我尝试使用以下代码切换tabBarvisible = true / false:

    protected function textArea_clickHandler(event:MouseEvent):void
        {
            if (tabBarVisible="true")   {
                tabBarVisible="false";
            }
            else if (tabBarVisible="false") {
                tabBarVisible="true";   } 
        }

but only can get tabBarvisible="true" and when i click again nothing happen. 但只能得到tabBarvisible =“true”,当我再次点击时没有任何事情发生。 the tabBarvisible won't turn to "false". tabBarvisible不会变为“false”。 is there something wrong with my code? 我的代码有问题吗?

Thanks. 谢谢。

Yes, you used only a single "=" sign so that actually assign the value instead of comparing it. 是的,您只使用了一个“=”符号,以便实际分配值而不是比较它。 Also, you don't need to use quotes for booleans. 此外,您不需要为布尔值使用引号。

tabBarVisible == true

Plus, as you're always toggling the value, you can simplify your code by simply inversing the value 另外,由于您总是切换值,因此只需反转值即可简化代码

protected function textArea_clickHandler(event:MouseEvent):void
{
    tabBarVisible = !tabBarVisible;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM