> > 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?
The internals are not changing the value property. They are in fact changing the 'selected' property and you are calling 'get value' in your alert, the value of which which is always calculated based on the current 'selected' property value. The binding event is fired only when the value property is changed by something else. And in your case, it is never changed and hence binding never occurs. - venkat http://www.venkatj.com --- In [email protected], Sherif Abdou <[EMAIL PROTECTED]> wrote: > > Doesnt he need ti dispatch an Event so it works? So dispatch the event then have it [Binable(event="eventName")] > > > ----- Original Message ---- > From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > To: [email protected] > Sent: Tuesday, January 22, 2008 12:56:05 AM > Subject: Re: [flexcoders] checkbox- create a bindable "value" property > > Hi, > > As far as I understand binding the bind works from the data out to the > bound component. So when the data is changed the componenet picks up the > change. However I don't believe it works the other way, in fact I'm sure > it doesn't. This makes sense as you should only change the data when you > are absolutely sure the data recieved is correct. > > So in this case you'll need a function triggered by the change on the > components to change _value. You will trace the correct value on the > component currently, but the data will not be changed. > > Hope this helps > > Tim > > > 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 > > > > > > > > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping >

