Search code examples
apache-flexadobeflex4.5flexbuilder

How to get a Flex 4.5 checkbox to change string value (text)


What i am trying to do is very simple but it does not seem to work

I am trying to get a checkbox event handler to change the text value of a string.

protected function
transport_yes_catching_bus_to_venue_checkbox_clickHandler(event:MouseEvent):void
{
if (transport_yes_catching_bus_to_venue_checkbox.selected==true)
{
totals_transport_I_catch_bus_to_venue.text = "YES"
}
}

and this is my label before the change is applied

<s:Label id="totals_transport_I_catch_bus_to_venue"
includeIn="a13_summary_for_submission"
x="170" y="625" color="#3B70D1" text="-----"/>

The idea is for the label to be changed from "----" to "YES" if the checkbox has been clicked. Otherwise the label stays as it was.

When i run the application the label does not change regardless of the state of checkbox.

THANKS!!


Solution

  • <s:Label id="totals_transport_I_catch_bus_to_venue" includeIn="a13_summary_for_submission"
    x="170" y="625" color="#3B70D1" text="{cbInput.selected?'YES':'-----'}" />
    
    <s:CheckBox id="cbInput" />