Cheers,
 
I'll have a fiddle...oooeer...

  _____  

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




here is an example straight from the Panel, hopfully no rules borken but
that is how you do it.

[Bindable("layoutChanged")]

public function get layout():String

{

return _layout;

}

/**

* @private

*/

public function set layout(value:String):void

{

if (_layout != value)

{

_layout = value;

if (layoutObject)

// Set target to null for cleanup.

layoutObject.target = null;

if (_layout == ContainerLayout.ABSOLUTE)

layoutObject = new CanvasLayout();

else

{

layoutObject = new BoxLayout();

if (_layout == ContainerLayout.VERTICAL)

BoxLayout(layoutObject).direction

= BoxDirection.VERTICAL;

else

BoxLayout(layoutObject).direction

= BoxDirection.HORIZONTAL;

}

if (layoutObject)

layoutObject.target = this;

invalidateSize();

invalidateDisplayList();

dispatchEvent(new Event("layoutChanged"));

}

}



----- Original Message ----
From: Tim Ashworth <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Tuesday, January 22, 2008 1:48:27 PM
Subject: RE: [flexcoders] Re: checkbox- create a bindable "value" property




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

  _____  

From: [EMAIL PROTECTED] ups.com <http://ups.com/>  [mailto:flexcoders@
yahoogroups. com] On Behalf Of rueter007
Sent: 22 January 2008 17:57
To: [EMAIL PROTECTED] ups.com <http://ups.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] ups.com <mailto:flexcoders%40yahoogroups.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] ups.com <mailto:flexcoders%40yahoogroups.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. <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.
<http://tools.search.yahoo.com/newsearch/category.php?category=shopping>
php?category= shopping
> >
>





  _____  

Never miss a thing. Make Yahoo
<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs> your homepage.


 

Reply via email to