2 Replies Latest reply on Sep 16, 2009 7:08 AM by Marlene

    Loop through buttons in linkBar

    Marlene Level 1

      Is there a way to loop through the linkButtons in a LinkBar. I want to be able to change the color of each of the button text to black. The dataprovider for the LinkBar is an Array.

        • 1. Re: Loop through buttons in linkBar
          Gregory Lafrance Level 6

          If this post answered your question or helped, please mark it as such.

           

          <?xml version="1.0"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
            <mx:Script>
              <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.LinkButton;

                [Bindable] private var linkData:ArrayCollection =
                  new ArrayCollection([
                  "Flash", "Director", "Dreamweaver", "ColdFusion"
                ]);  

                private function changeColor():void{
                  for each(var obj:LinkButton in linkbar.getChildren()){
                    if(obj.label == "Director"){
                      obj.setStyle("color", "0x00FF00");
                    }
                  }
                }
              ]]>
            </mx:Script>
            <mx:LinkBar color="0xFF0000" id="linkbar" 
              horizontalAlign="right" borderStyle="solid"
              itemClick="navigateToURL(new URLRequest('http://www.adobe.com/' +
                String(event.label).toLowerCase()), '_blank');">
              <mx:dataProvider>
                {linkData}
              </mx:dataProvider>
            </mx:LinkBar>
            <mx:Button label="Change Director Color" click="changeColor();"/>
          </mx:Application>

          • 2. Re: Loop through buttons in linkBar
            Marlene Level 1

            Great answer. I am still interested in outside help. Please respond to options@frontex.com.