1 Reply Latest reply on Aug 31, 2010 12:39 PM by UbuntuPenguin

    TabBar's ViewStack set from outside

    Antoine Alberti

      Hi,

       

      I have a component that contains a spark TabBar (sdk 4.1). Because it's a SkinPart, the component is written in actionScript. And because we find the code that composes applications more readable in mxml, we'd prefer defining the viewstack in another mxml file.

       

      But... I didn't find how to make this work. Or there is a bug in spark TabBar or mx ViewStack. Actually the view stack is displayed, but not the tab bar.

       

      Here's the tiniest code I could to demonstrate the issue.

       

      TabsWithContent.as:

      package
      {
          import spark.components.Group;
          import spark.components.TabBar;


          public class TabsWithContent extends Group
          {
              public var tabs:TabBar;
              public function TabsWithContent()
              {
              }
          }
      }

       

      App.mxml:

      <?xml version="1.0" encoding="utf-8"?>

       

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

       

                     xmlns:s="library://ns.adobe.com/flex/spark"

       

                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:local="*">

       

          <fx:Declarations>

       

              <!-- Place non-visual elements (e.g., services, value objects) here -->

       

          </fx:Declarations>

       

          <local:TabsWithContent>

       

              <local:layout>

       

                  <s:VerticalLayout/>

       

              </local:layout>

       

              <local:tabs>

       

                  <s:TabBar dataProvider="{vs}"/>

       

              </local:tabs>

       

              <mx:ViewStack id="vs">

       

                  <s:NavigatorContent label="1">

       

                      <s:Label text="11"/>

       

                  </s:NavigatorContent>

       

                  <s:NavigatorContent label="2">

       

                      <s:Label text="22"/>

       

                  </s:NavigatorContent>

       

              </mx:ViewStack>

       

          </local:TabsWithContent>

       

      </s:Application>

       

      What did I not understand? What should I do to correct or workaround this?

      Thanks

      AA