我在FlexLib中看到了SuperTabNavigator,但它似乎并没有为我所用。
我发现这个html button code,并且能够注入我自己的TabBar并在创建navItem时让它改变由ClassFactory实例化的类。
HtmlTabNavigator:
public class HtmlTabNavigator extends TabNavigator
{
public function HtmlTabNavigator()
{
super();
}
override protected function createChildren():void
{
if (!tabBar)
{
tabBar = new HtmlTabBar(); // inject my class
tabBar.name = "tabBar";
tabBar.focusEnabled = false;
tabBar.styleName = new StyleProxy(this, tabBarStyleFilters);
rawChildren.addChild(tabBar);
if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
{
tabBar.setStyle("paddingTop", 0);
tabBar.setStyle("paddingBottom", 0);
tabBar.setStyle("borderStyle", "none");
}
}
super.createChildren(); // ommits original TabBar creation but continues in inheritance chain
}
public function setHtmlLabels(htmlLabels:Array):void
{
for (var i:uint = 0; i < tabBar.numChildren; i++)
{
var button:Button = tabBar.getChildAt(i) as Button;
button.label = htmlLabels[ i ];
}
}
}
HtmlTabBar:
public class HtmlTabBar extends TabBar
{
public function HtmlTabBar()
{
super();
navItemFactory = new ClassFactory(HtmlButton);
}
}
现在我在与按钮的风格问题,因为它看起来像一个普通的按钮,而不是像一个标签了。我不明白为什么在使用ButtonBarButton时这会起作用。
欢迎任何想法。
感谢 斯特凡
2009-06-28
Stefan
+0
通过为HtmlTabNavigator和HtmlButton实现我自己的皮肤,我能够克服有限目的的样式问题。仍然会对组件感兴趣。 –
2009-06-29 21:54:41