OK, I'm interested in this - how does it work binding to an event?  Could
someone post some code as an example?
 
t

  _____  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rueter007
Sent: 22 January 2008 17:57
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: checkbox- create a bindable "value" property



or as Sherif pointed out, you can check for the selected property
change and fire a custom event and mark the bindable tag for the
'value' property with that custom event.

--- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com,
"rueter007" <[EMAIL PROTECTED]> wrote:
>
> > > 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. <http://www.venkatj.com> com
> 
> --- In [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com,
Sherif Abdou <sherif626@> wrote:
> >
> > Doesnt he need ti dispatch an Event so it works? So dispatch the
> event then have it [Binable(event="eventName")]
> > 
> > 
> > ----- Original Message ----
> > From: "tim@" <tim@>
> > To: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com
> > 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.
<http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
search.yahoo.com/newsearch/category.php?category=shopping
> >
>



 

Reply via email to