Flex 4 Tabbar – Disable tab

Is there a common way to disable the tabs of the spark tabbar component in flex 4? With the mx tabnavigator component, you only need to disable the content corresponding to the tab, and then also disable the tab. But doing this with the spark tab bar component only disables the content and not the tab.

This is my simple example:







< /s:NavigatorContent>














A lot,
Florian

Appendix:
Two minutes after I returned to actual work , I found an “elegant” solution using skins.

If you apply a custom skinClass to the tab bar, you can bind the tab.enabled property as expected/wanted.


[Bindable] private var tab2IsReady:Boolean = false;

private function checkCriteria():void{
tab2IsReady = someOtherThing.isFinished;//Boolean
}
]]>


dataProvider="{viewStack}"
skinClass="skins.CustomTabBarSkin"/>









When you enter “skinClass”, use auto complete to generate (in FlashBuilder~4.5???) a custom skin (named anything you want).
The code will be as follows Show (I omitted the Script tag).




xmlns :fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fb=" http://ns.adobe.com/flashbuilder/2009"
alpha.disabled="0.5">


/**
* @copy spark.skins.spark.ApplicationSkin#hostComponent
*/
[HostComponent("spark.components.TabBar")]
]]>






















Change:



To:


enabled="{data.enabled}" />

Then any In ViewStack, its enabled property settings or bindings will fully meet your expectations (enabled when it is true, and disabled when it is false).

Is there a common way to disable the tabs of the spark tabbar component in flex 4? With the mx tabnavigator component, you only need to disable the content corresponding to the tab, and then also disable the tab. But doing this with the spark tab bar component only disables the content and not the tab.

This is my simple example:







< /s:NavigatorContent>














A lot,
Flo Rian

Appendix:
Two minutes after I returned to actual work, I found an “elegant” solution using skins. < p>

If you apply a custom skinClass to the tab bar, you can bind the tab.enabled attribute as expected/want.

< fx:Script>
[Bindable] private var tab2IsReady:Boolean = false;

private function checkCriteria():void{
tab2IsReady = someOtherThing.isFinished;//Boolean
}
]]>


dataProvider="{viewStack}"
skinClass="skins.CustomTabBarSkin"/>









When you enter “skinClass”, use auto complete to generate (in FlashBuilder~ 4.5 ???) Custom skin (named whatever you want).
The code will look like the following (I omitted the Script tag).

 


xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns :s="library://ns.adobe.com/flex/spark"
xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
alpha.disabled=" 0.5">


/**
* @copy spark.skins.spark.ApplicationSkin#hostComponent
*/
[HostComponent("spark.components.TabBar")]
]]>






< br />














Change:



To:


enabled= "{data.enabled}" />

Then any in the ViewStack, its enabled property settings or bindings will be fully in line with you Expected (enabled when true, disabled when false) .

Leave a Comment

Your email address will not be published.