1 Reply Latest reply on Jan 17, 2007 10:05 AM by awclemen

    Colors

    187_2007 Level 1
      http://www.franticphotos.com/0personal0/flex/bin/main.html

      When you mouse over the labels they change color, click on one of the labels and the color will resort back to original color. How can I get that label to stay highlighted?
        • 1. Re: Colors
          Level 1
          You need to adjust the FillColors ( and probably the alphas) when you capture the click event property of the button. Here's a quick example that worked for me:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application
          xmlns:mx=" http://www.adobe.com/2006/mxml"
          x="0" y="0"
          paddingLeft="0"
          paddingTop="0"
          paddingBottom="0"
          paddingRight="0"
          backgroundColor="#FFFFFF" >

          <mx:Style source="../../../style/autumn.css"/>

          <mx:Script>
          <![CDATA[
          private function makeHappyButton(evt:Event):void
          {
          var previousButton:Button = evt.target as Button;
          previousButton.setStyle("fillColors",["#FF0000", "#FF0000", "#FF0000", "#FF0000"]);
          previousButton.setStyle("borderColor", "#FF0000");
          }


          ]]>
          </mx:Script>
          <mx:Panel id="happyPanel" layout="absolute" percentWidth="100" percentHeight="100" >
          <mx:Button id="clickButton" label="click me" click="makeHappyButton(event)" />
          </mx:Panel>
          </mx:Application>

          There is also a very cool app via adobe that shows how the various styles work with their objects:

          http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html

          --Andy