1 Reply Latest reply on Jan 23, 2008 6:51 PM by

    Strange error LinkBar-ViewStack (bug?)

      Hi, I came across a strange problem I can't fix, I am willing to think about it as a bug, but are not sure about all events and refresh things behind the scene. have tried hotfix 2&3 wich fixes garbage collector problem in ViewStack, without result.

      This is the essential mxml:
      <mx:Application>
      <mx:LinkBar id="myLinkBar" dataProvider="{myViewStack}"/>
      <mx:ViewStack width="100%" height="100%" id="myViewStack"/>
      </mx:Application>

      ActionScript:
      private function Add():void
      {
      var child:Container = new Panel();
      myViewStack.addChild(child);
      //myLinkBar.selectedIndex = 0; // works first time
      }

      private function Remove():void
      {
      myViewStack.removeAllChildren();
      }

      Now to the problem, I have a menu wich load views into a viewstack after login, if user logout, I remove all viewstack views, but if the user login again (on same flex app) the selectedIndex=0 not working and clicking first (or any) link button creates a runtime error after repeted login/logout (add/removeAll).

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.skins.halo::HaloBorder@eff9101 to mx.controls.Button.
      at mx.controls::LinkBar/hiliteSelectedNavItem()[E:\dev\flex_201_borneo\sdk\frameworks\mx\con trols\LinkBar.as:455]
      at mx.controls::LinkBar/clickHandler()[E:\dev\flex_201_borneo\sdk\frameworks\mx\controls\Lin kBar.as:528]