1 Reply Latest reply on Aug 29, 2008 2:14 AM by Newsgroup_User

    labelPlacement in linkButton problem

    Dennis_gull
      Hello everyone,
      I got a problem with my LinkBar, in the active linkButton I show an image at the bottom (labelPlacement = top), this works okay at two places but the main navigation menu have to load a lot of data each time you click on a linkButton so when I place out the active Icon in the main LinkBar it will automatically be placed at the top for a very short time and then it jumps down to the bottom where it should be placed at first.
      To change the icons I listen to the LinkBar "creationComplete" and ViewStack "change" and this is how my two functions look like:
      quote:


      private var selected:uint;

      private function initLinkBar():void {
      selected = myViewStack.selectedIndex;
      var num:uint = myLinkBar.numChildren;
      for(var i:uint = 0;i<num;i++) {
      var btn:Button = myLinkBar.getChildAt(i) as Button;
      btn.labelPlacement = "top";
      btn.height = 26;
      if(myViewStack.selectedIndex == i) btn.setStyle("icon",Icons.LINKBAR_ORANGE);
      else btn.setStyle("icon",Icons.LINKBAR_TRANSPARENT);
      }
      }

      private function linkBarChange():void {
      var btn1:Button = myLinkBar.getChildAt(selected) as Button;
      btn1.setStyle("icon",Icons.LINKBAR_TRANSPARENT);
      var btn2:Button = myLinkBar.getChildAt(myViewStack.selectedIndex) as Button;
      btn2.setStyle("icon",Icons.LINKBAR_ORANGE);
      selected = myViewStack.selectedIndex;
      }