[flexcoders] Re: unable to bind to property warnings binding to read-only properties

2008-05-21 Thread Doug Lowder
Yes, sorry for the confusion.  That should have been:

creationComplete=event.currentTarget.someProperty=foo.bar


--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 We don't recommend putting curly braces around the values of event
 attributes like creationComplete... that makes it look like 
databinding
 even though it isn't.
 
  
 
 Gordon Smith
 
 Adobe Flex SDK Team
 
  
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of Doug Lowder
 Sent: Tuesday, May 20, 2008 3:18 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: unable to bind to property warnings 
binding
 to read-only properties
 
  
 
 Binding has a lot of associated overhead and doesn't really serve 
any 
 purpose when it's a value you know is never going to change. 
 Somehting like the following works well for me.
 
 someProperty={foo.bar}
 
 becomes:
 
 creationComplete={event.currentTarget.somePorperty=foo.bar}
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , mikebgrove mikebgrove@ 
 wrote:
 
  i make extensive use of read-only properties in my ActionScript 
  code. i find that anywhere i try to bind to a read only property 
i 
  get a warning in flex builder's debug mode indicating that flex 
 can't 
  bind to the property.
  
  here's a simple class to illustrate the point.
  
  package 
  {
  public class Foo
  {
  public function get bar():String {
  return bar;
  }
  }
  }
  
  if foo is an [Bindable] instance of Foo, then a binding to 
 {foo.bar} 
  will produce this warning:
  
  warning: unable to bind to property 'bar' on class 'Foo' (class 
is 
  not an IEventDispatcher).
  
  Foo is not an IEventDispatcher, but since every property of Foo 
is 
  immutable it shouldn't need to be.
  
  this may be a flex defect, judging by the title of the defect at 
  http://bugs.adobe.com/jira/browse/SDK-1046.
 http://bugs.adobe.com/jira/browse/SDK-1046.  i've asked adobe 
 support 
  to make more details about this defect public.
  
  i'm interested in strategies to avoid this warning for read-only 
  properties. in some cases this warning is instrumental in helping 
 me 
  figure out a binding problem, but unfortunately the important 
  warnings are nearly impossible to find among the hundreds of 
  irrelevant warnings for binding to read-only properties.
  
  here are some of the strategies i can think of, none great (i'll 
  continue using the above Foo class as an example):
  
  1) don't bind to {foo.bar}, bind to {getBar(foo)} or {foo.getBar
 ()}, 
  adding the getBar method either to the MXML component trying to 
 bind 
  to foo or the Foo class itself.
  2) declare the bar getter function as [Bindable] to a made up 
event 
  name, e.g. 
  [Bindable(event=barChangedNeverGonnaHappen)]
  
  are there other strategies people have employed to eliminate 
these 
  warnings for read-only properties? i trust i'm not the only one 
  whose eclipse debug console has been consumed with warnings like 
  these.
  
  thanks.
  
  -mike
 





[flexcoders] Re: unable to bind to property warnings binding to read-only properties

2008-05-20 Thread Doug Lowder
Binding has a lot of associated overhead and doesn't really serve any 
purpose when it's a value you know is never going to change.  
Somehting like the following works well for me.

  someProperty={foo.bar}

becomes:

  creationComplete={event.currentTarget.somePorperty=foo.bar}


--- In flexcoders@yahoogroups.com, mikebgrove [EMAIL PROTECTED] 
wrote:

 i make extensive use of read-only properties in my ActionScript 
 code.  i find that anywhere i try to bind to a read only property i 
 get a warning in flex builder's debug mode indicating that flex 
can't 
 bind to the property.
 
 here's a simple class to illustrate the point.
 
 package 
 {
   public class Foo
   {
   public function get bar():String {
   return bar;
   }
   }
 }
 
 if foo is an [Bindable] instance of Foo, then a binding to 
{foo.bar} 
 will produce this warning:
 
 warning: unable to bind to property 'bar' on class 'Foo' (class is 
 not an IEventDispatcher).
 
 Foo is not an IEventDispatcher, but since every property of Foo is 
 immutable it shouldn't need to be.
 
 this may be a flex defect, judging by the title of the defect at 
 http://bugs.adobe.com/jira/browse/SDK-1046.  i've asked adobe 
support 
 to make more details about this defect public.
 
 i'm interested in strategies to avoid this warning for read-only 
 properties.  in some cases this warning is instrumental in helping 
me 
 figure out a binding problem, but unfortunately the important 
 warnings are nearly impossible to find among the hundreds of 
 irrelevant warnings for binding to read-only properties.
 
 here are some of the strategies i can think of, none great (i'll 
 continue using the above Foo class as an example):
 
 1) don't bind to {foo.bar}, bind to {getBar(foo)} or {foo.getBar
()}, 
 adding the getBar method either to the MXML component trying to 
bind 
 to foo or the Foo class itself.
 2) declare the bar getter function as [Bindable] to a made up event 
 name, e.g. 
   [Bindable(event=barChangedNeverGonnaHappen)]
 
 are there other strategies people have employed to eliminate these 
 warnings for read-only properties?  i trust i'm not the only one 
 whose eclipse debug console has been consumed with warnings like 
 these.
 
 thanks.
 
 -mike





RE: [flexcoders] Re: unable to bind to property warnings binding to read-only properties

2008-05-20 Thread Gordon Smith
We don't recommend putting curly braces around the values of event
attributes like creationComplete... that makes it look like databinding
even though it isn't.

 

Gordon Smith

Adobe Flex SDK Team

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Doug Lowder
Sent: Tuesday, May 20, 2008 3:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: unable to bind to property warnings binding
to read-only properties

 

Binding has a lot of associated overhead and doesn't really serve any 
purpose when it's a value you know is never going to change. 
Somehting like the following works well for me.

someProperty={foo.bar}

becomes:

creationComplete={event.currentTarget.somePorperty=foo.bar}

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, mikebgrove [EMAIL PROTECTED] 
wrote:

 i make extensive use of read-only properties in my ActionScript 
 code. i find that anywhere i try to bind to a read only property i 
 get a warning in flex builder's debug mode indicating that flex 
can't 
 bind to the property.
 
 here's a simple class to illustrate the point.
 
 package 
 {
 public class Foo
 {
 public function get bar():String {
 return bar;
 }
 }
 }
 
 if foo is an [Bindable] instance of Foo, then a binding to 
{foo.bar} 
 will produce this warning:
 
 warning: unable to bind to property 'bar' on class 'Foo' (class is 
 not an IEventDispatcher).
 
 Foo is not an IEventDispatcher, but since every property of Foo is 
 immutable it shouldn't need to be.
 
 this may be a flex defect, judging by the title of the defect at 
 http://bugs.adobe.com/jira/browse/SDK-1046.
http://bugs.adobe.com/jira/browse/SDK-1046.  i've asked adobe 
support 
 to make more details about this defect public.
 
 i'm interested in strategies to avoid this warning for read-only 
 properties. in some cases this warning is instrumental in helping 
me 
 figure out a binding problem, but unfortunately the important 
 warnings are nearly impossible to find among the hundreds of 
 irrelevant warnings for binding to read-only properties.
 
 here are some of the strategies i can think of, none great (i'll 
 continue using the above Foo class as an example):
 
 1) don't bind to {foo.bar}, bind to {getBar(foo)} or {foo.getBar
()}, 
 adding the getBar method either to the MXML component trying to 
bind 
 to foo or the Foo class itself.
 2) declare the bar getter function as [Bindable] to a made up event 
 name, e.g. 
 [Bindable(event=barChangedNeverGonnaHappen)]
 
 are there other strategies people have employed to eliminate these 
 warnings for read-only properties? i trust i'm not the only one 
 whose eclipse debug console has been consumed with warnings like 
 these.
 
 thanks.
 
 -mike


 



Re: [flexcoders] Re: unable to bind to property warnings binding to read-only properties

2008-05-20 Thread Troy Gilbert
 We don't recommend putting curly braces around the values of event
 attributes like creationComplete... that makes it look like databinding even
 though it isn't.

And to finish Gordon's thought: event attributes are already
interpreted by the compiler as AS code, not values, so they're
unnecessary, whereas non-event attributes are interpreted as values.

Troy.