2 Replies Latest reply on Feb 13, 2007 11:40 PM by Mosphat

    Dynamic viewstack/tabbar

    Mosphat Level 1
      Hello,

      I'm trying to get the following to work:

      private function createTabbedViews(viewCount:int):void {
      var viewstack:ViewStack = new ViewStack();
      var tabs:TabBar = new TabBar();
      var i:int;
      var stackTraceView:StackTrace;

      viewstack.id = "viewstack";
      tabs.dataProvider = "viewstack";

      for (i = 0; i < viewCount; i++) {
      stackTraceView = createStackTraceView(dataProvider .StackWalk);
      stackTraceView.label = "Stacktrace " + (i + 1).toString();
      viewstack.addChild(stackTraceView);
      }
      this.addChild(viewstack);
      this.addChild(tabs);
      }

      This function should create a tabbar and a viewstack based on a ArrayCollection (dataProvider
      .StackWalk). It almost works, only the line 'tabs.dataProvider = "viewstack";' throws an error telling me it can't find 'viewstack'. What am I doing wrong here?

      Bonus question: I'd like the viewstack to use 100% of the available width, but neither 'viewstack.width = "100%"' or 'viewstack.setStyle("width", "100%")' work. Help?

      Regards,
      Ruud