Yes, unless "Person" extends mx:Object, or is explicitly declared as
dynamic, a hard reference to a property name will give a compile error if
that property does not exist.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of droponrcll
Sent: Sunday, November 08, 2009 10:07 AM
To: [email protected]
Subject: [SPAM] [flexcoders] Re: Get strong propertyName from object so it
would break at compile time if changed

 

  



--- In [email protected] <mailto:flexcoders%40yahoogroups.com> ,
"tntomek" <tnto...@...> wrote:
>
> Is there a way to get a strong property name from an object?
> 
> scenario ... Person class having "weight" property
> 
> var column:DataGridColumn
> column.dataField = "weight"; 
> 
> can i do something like:
> 
> column.dataField = Person.weight.getPropertyName();
> 
> ... so that if this "weight" property is renamed one day I would get
compile time warning?
>

You can look for Person.hasOwnProperty('weight') to see if the property
exists at runtime. If you want a compile-time warning, just put in a hard
reference somewhere to aPerson.weight.

HTH;

Amy



Reply via email to