change button color


i have group of buttons , when each 1 clicked color should change. when button clicked color of previous button should change normal..plz help..thanks in advance

hi mssrivatsa,

 

you can below:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:script>
  <![cdata[
   private var previousbuttonclicked:button;
  
   private function buttonclickhandler(event:mouseevent):void
   {
    if(previousbuttonclicked)
    {
     previousbuttonclicked.setstyle("color","green");
    }
    previousbuttonclicked = event.currenttarget button;
    button(event.currenttarget).setstyle("color","red");
   }
  ]]>
</mx:script>

<mx:hbox>
  <mx:button id="btn1" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn2" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn3" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn4" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn5" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn6" label="button" color="green" click="buttonclickhandler(event);"/>
  <mx:button id="btn7" label="button" color="green" click="buttonclickhandler(event);"/>
</mx:hbox>
</mx:application>

 


if post answers question or helps, please kindly mark such.


thanks,

bhasker chari



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Using Arduino Uno R3 to bootload the atmega328-PU (non pico)

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support

How to update nested ListCollectionViews?