1 Reply Latest reply on Jan 25, 2011 4:40 PM by thenewmexican62

    setting the background color on a mx:Button component

    thenewmexican62 Level 1

      Im trying to creatve a button which flashes from red,back to its normal color as the result of an event.

      I want the background, and, foregrown colors to change. Changing the foreground color is easy.

      a simple setStyle("color","some hex value");

       

      However. I tried the following with zero results. Actually this throws a null pointer exception on

       

      if(runDemoBtn.getStyle("themeColor").toString(16) == "ff0000"){ //: Theme color is undefined

       

      public function flashRunDemoButton(event:Event):void {
                 
                  flashTimer = new Timer(1300);
                  flashTimer.addEventListener(TimerEvent.TIMER,changeRunButtonColor);
                  flashTimer.start();
                  runDemoBtn.setStyle("themeColor","#ff0000");
                 
              }
             
                 
              private function changeRunButtonColor(event:TimerEvent):void {
                 
                  trace("inside changeRunButtonColor");
                     
                  if(runDemoBtn.getStyle("themeColor").toString(16) == "ff0000"){
                      //: Change to the default
                      runDemoBtn.setStyle("themeColor",runDemoButtonThemeColor);
                  }
                     
                  else {
                         
                          runDemoBtn.setStyle("themeColor","#ff0000");
                      }
                  }

       

       

       

      Can someone point me in the right direction.

      Thanks.