9 Replies Latest reply on Sep 15, 2010 5:02 AM by Ibarim

    LinkBar enable/disable problem

    Ibarim Level 1

      I got a LinkBar and a ViewStack connected.

      I got some forms on a viewstack component. When user edit these forms I want the LinkBar to be disabled. When user finish I want to enable it back, but I cannot set LinkBar's button to indicate that it is selected.


      <mx:LinkBar id="myLinkBar" selectedIndex="1" dataProvider="myViewStack"/>

      <mx:ViewStack id="myViewStack" >



      <mx:Button id="myButt" label="Edit" click="editForms()" />

      <mx:Form id="myForm"......






      private function editForms():void {

      if (myButt.label=="Edit") {




      } else if (myButt.label=="Save"){




      myLinkBar.selectedIndex=1;  //this component is visible, but I want the button of index 1 to be pressed




      In above example when myLinkBar is enabled (after pressing 'Save' button) it shows current viewStack component (myComponent2), but the LinkBar's button itself is not pressed. When I press the button, which has index=1 I got error:

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.skins.halo::HaloBorder@2677401 to mx.controls.Button.
      at mx.controls::LinkBar/hiliteSelectedNavItem()[C:\autobuild\3.2.0\frameworks\projects\frame work\src\mx\controls\LinkBar.as:525]
      at mx.controls::LinkBar/clickHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\ mx\controls\LinkBar.as:598]


      Furhtermore: when I set different selectedIndex (not the one, that is current, i.e. selectedIndex=0) everything works fine - the button of index specified (0) is pressed and no error occurs.