Just thought of another use for properties: component parameters.

With properties you can do something like this:

[Inspectable]
public function get percent():Number {
  return _percent;
}
public function set percent(value:Number):Void {
 _percent = normalizePercentage(value);
}
private var _percent:Number = 0;
private static function normalizePercentage(value:Number):Number {
 if (!isFinite(value)) {
   return 0;
 }
 if (value > 100) {
   return 100;
 }
 return Math.floor(value);
}
//...

This code will create a property called "percent" which can be set by
a component parameter and will never evaluate to anything but an
integer from 0 to 100. If you were using getPercent() and
setPercent(), you couldn't have the inspectable component parameter.
--
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to