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;
}
精彩评论