开发者

Flex mobile Turning tabBar visible = True/False?

开发者 https://www.devze.com 2023-04-01 08:05 出处:网络
i try to toggle tabBarvisible = true/false with the following code: protected function textA开发者_高级运维rea_clickHandler(event:MouseEvent):void

i try to toggle tabBarvisible = true/false with the following code:

    protected function textA开发者_高级运维rea_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. the tabBarvisible won't turn to "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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消