2 Replies Latest reply on Oct 21, 2008 3:33 PM by ntsiii

    I want to chang the linkbar selectedItem Highlighted

    Mike.Huang

      <?xml version="1.0" encoding="utf-8"?>
      <mx:LinkBar xmlns:mx=" http://www.adobe.com/2006/mxml" childAdd="childAddHandler(event);">
      <mx:Script>
      <![CDATA[
      import mx.controls.LinkButton;
      import mx.collections.ArrayCollection;
      import mx.controls.Button;
      import mx.core.UIComponent;
      import mx.events.ChildExistenceChangedEvent;

      import mx.core.Container
      public var list:ArrayCollection;
      private function childAddHandler(event:ChildExistenceChangedEvent):void
      {
      trace('childAdd')
      if(null == list)
      {
      list = new ArrayCollection();
      }
      if(event.relatedObject is LinkButton)
      {
      list.addItem(event.relatedObject);
      }
      }

      public function get selectedItem():LinkButton
      {
      var lb:LinkButton;
      if(list != null)
      {
      if(list.length > selectedIndex && selectedIndex != -1)
      {
      lb = list.getItemAt(selectedIndex) as LinkButton;
      }
      }
      return lb;
      }
      override public function removeAllChildren():void
      {
      super.removeAllChildren();
      list = null;
      }
      ]]>
      </mx:Script>
      </mx:LinkBar>
      Why can not change the SelectedItem Style?