I made this changes e still doesn't work, some one had another advice? My test app:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:com="*" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:TextInput id="tiTitulo" width="200" maxChars="100" change="descCounter.countChars(tiTitulo.length)"/> <com:CharCounter id="descCounter" maxChars="{tiTitulo.maxChars}" /> </mx:Application> My component: <?xml version="1.0" encoding="utf-8"?> <mx:Label text="{String(_charNumber)}" xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()" > <mx:Script> <![CDATA[ [Bindable] private var _charNumber:Number; [Bindable] private var _maxChars:Number; private function init():void{ _charNumber = _maxChars; } public function set maxChars(value:Number):void{ _maxChars = value; trace("MAXCHARS"+_maxChars); } public function get maxChars():Number{ return _maxChars; } public function countChars(value:Number):void{ var maxChars :Number = _maxChars; _charNumber = maxChars - value; } ]]> </mx:Script> </mx:Label> I receiving NaN instead of input maxchar value. Thanks. --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > And put a trace() in the setter, to make sure it is getting called with > a value. > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Paul Andrews > Sent: Sunday, February 10, 2008 4:32 PM > To: flexcoders@yahoogroups.com > Subject: Re: [flexcoders] Re: Adobe SDK, why flex comps accept bind in > properties and custom comps dont? > > > > You haven't specified _maxChars as bindable. Rather bizarrely _maxChars > is a > String, the setter is a Number, the getter is String. Your original > example > refers to 'max' .. > > If nothing else I would say that _maxChars needs to be Bindable, your > component reference needs to be consistent with the actual component and > > having different types for the setter and getter is just bad practice.. > > Paul > ----- Original Message ----- > From: "danielvlopes" <[EMAIL PROTECTED] > <mailto:danielvlopes%40yahoo.com> > > To: <flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > > Sent: Sunday, February 10, 2008 4:28 PM > Subject: [flexcoders] Re: Adobe SDK, why flex comps accept bind in > properties and custom comps dont? > > > Thanks everybody... my comp hade this code: > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Label text="{_charNumber}" > > xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " initialize="init()" > > > > > <mx:Script> > > <![CDATA[ > > > > [Bindable] > > private var _charNumber:String; > > private var _maxChars:String; > > > > private function init():void{ > > _charNumber = _maxChars; > > } > > > > public function set maxChars(value:Number):void{ > > _maxChars = value.toString(); > > } > > > > public function get maxChars():Number{ > > return Number(_maxChars); > > } > > > > public function countChars(value:Number):void{ > > var maxChars :Number = Number(_maxChars); > > _charNumber = String(maxChars - value); > > } > > ]]> > > </mx:Script> > > </mx:Label> > > > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <tspratt@> > wrote: > >> > >> You have some other problem. Custom components work fine doing this. > >> > >> > >> > >> How have you implemented the "max" property in the component? > >> > >> > >> > >> Tracy > >> > >> > >> > >> ________________________________ > >> > >> From: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > ] On > >> Behalf Of danielvlopes > >> Sent: Friday, February 08, 2008 8:17 AM > >> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > >> Subject: [flexcoders] Re: Adobe SDK, why flex comps accept bind in > >> properties and custom comps dont? > >> > >> > >> > >> Ops, sorry... > >> The working example is this: > >> <com:MyLabel id="myLabel" max="300" /> > >> > >> and adobe comps accept something like this (justa example): > >> <mx:TextArea width="{myLabel.height}" > >> > >> --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > >> , Tom Chiverton <tom.chiverton@> > >> wrote: > >> > > >> > On Thursday 07 Feb 2008, danielvlopes wrote: > >> > > <com:MyLabel max="{myTextArea.lenght}" /> > >> > > <com:MyLabel max="{myTextArea.lenght}" /> > >> > > >> > Your 'working' and 'not working' examples are the same, and both > >> > misspell 'length'. > >> > > >> > -- > >> > Tom Chiverton > >> > Helping to challengingly promote vertical e-tailers > >> > on: http://thefalken.livejournal.com > <http://thefalken.livejournal.com> > >> <http://thefalken.livejournal.com <http://thefalken.livejournal.com> > > > >> > > >> > **************************************************** > >> > > >> > This email is sent for and on behalf of Halliwells LLP. > >> > > >> > Halliwells LLP is a limited liability partnership registered in > >> England and Wales under registered number OC307980 whose registered > >> office address is at Halliwells LLP, 3 Hardman Square, > Spinningfields, > >> Manchester, M3 3EB. A list of members is available for inspection at > >> the registered office. Any reference to a partner in relation to > >> Halliwells LLP means a member of Halliwells LLP. Regulated by The > >> Solicitors Regulation Authority. > >> > > >> > CONFIDENTIALITY > >> > > >> > This email is intended only for the use of the addressee named > above > >> and may be confidential or legally privileged. If you are not the > >> addressee you must not read it and must not use any information > >> contained in nor copy it nor inform any person other than Halliwells > >> LLP or the addressee of its existence or contents. If you have > >> received this email in error please delete it and notify Halliwells > >> LLP IT Department on 0870 365 2500. > >> > > >> > For more information about Halliwells LLP visit www.halliwells.com. > >> > > >> > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> > > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > <http://www.mail-archive.com/flexcoders%40yahoogroups.com> > > Yahoo! Groups Links > > > > > > > > >