You should never need to use getRGB() in Flex; this is a low-level Flash API. You would use getStyle() and setStyle() on the Button object, and store the old color in a instance var.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" >

 

            <mx:Script>

 

                        var oldColor;

                       

                        function b2_click()

                        {

                                    if (oldColor == undefined)

                                    {

                                                oldColor = b1.getStyle("color");

                                                b1.setStyle("color", 0xFF0000);

                                    }

                                    else

                                    {

                                                b1.setStyle("color", oldColor);

                                                oldColor = undefined;

                                    }

                        }

 

            </mx:Script>

           

            <mx:Button id="b1" label="Button"/>

 

            <mx:Button id="b2" label="Click Me" click="b2_click()"/>

 

</mx:Application>

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dave buhler
Sent: Monday, June 06, 2005 9:16 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] How do you store and then retrieve the backcolor of something

 

getRGB()

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary143.html

On 6/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I am asking because what I want to do is change the color of a button to a different color but later on reset it to its original color. How do you first store the value of the original color and how do you call it back later?


Yahoo! Groups Links





Yahoo! Groups Links

Reply via email to