开发者

Flex mobile Turning tabBar visible = True/False?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜