Hello! I want a checkbox to return 1 or 0 instead of true or false
respectively. Here's my component:

<?xml version="1.0" encoding="utf-8"?>
<mx:CheckBox xmlns:mx="http://www.adobe.com/2006/mxml";>
<mx:Script>
<![CDATA[
private var _value:Number;

[Bindable]
public function get value():Number{
if(selected==true)
{
   _value=1;
   return _value;

}
else
{
   _value=0;
   return _value;
}

}

public function set value(val:Number):void{
if (val==1)
{
   _value=1;
   selected=true;
}
else
{
   _value=0;
   selected=false;
}

}

]]>
</mx:Script>
</mx:CheckBox>


When i try to bind a data model to the "value" property, it doesn't
update the model when the value changes. However, when I do:
click="Alert.show(value)", it returns 0 or 1 as expected. So it
seems that the internals are changing the value correctly, but the
bind isn't working? Thanks for all your help! -bmiles

Reply via email to