You are setting 'color' style instead of 'fillColors' style in your changebackcolor() function. Change the 'color' to 'fillColors' in changebackcolor() as well as in changecolor() function and it should work.
 
Thanks
-Ashish


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 9:55 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How do you store and then retrieve the backcolor of something

Can someone explain why this code does not work then? I tried to make it so that it will change the button color to red then back to its original color but its not working?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">
 
<mx:Script>
 
<![CDATA[
public var oldColor:Object;
]]>
 

public function changecolor(){
 oldColor= buttonthree.getStyle("color");
buttonthree.setStyle("fillColors", [0xCCC333,0xCC0065])
 
}
public function changebackcolor(){
 
buttonthree.setStyle("color", [oldColor])
}
</mx:Script>
 

<mx:HBox id="buttonstocolor" visible="true">
 

  <mx:Button label="press to restore color" click="changebackcolor()" id="Buttonone" />
<mx:Button label= "Press to change color" click="changecolor()" id="Buttontwo"/>
<mx:Button width="30" id="buttonthree"/>
 
</mx:HBox>
</mx:Application>


Yahoo! Groups Links

Reply via email to