0
votes

I have a button in action script with toggle="true". Now when I click the button its color changes and it looks as if it has been disabled (but its actually not). I need to know which property of this button has changed? For example if I need to know somewhere in my code the "toggled state" (if there is any such thing) of this button, which property of this button should I check?

Thanks.

1

1 Answers

0
votes

Button.selected is what your looking for, I made an example to demonstrate this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                creationComplete="init(event)">

    <mx:Script>
        <![CDATA[
        import flash.events.MouseEvent;
        import mx.events.FlexEvent;

        private function init(e:FlexEvent):void
        {
            onButtonClick();

        }// end function

        protected function onButtonClick(e:MouseEvent = null):void
        {
            if (button.selected) button.label = "button selected"
            else button.label = "button not selected";

        }// end function
        ]]>
    </mx:Script>

    <mx:Button id="button" toggle="true" click="onButtonClick()"></mx:Button>

</mx:Application>