Percent
| Kind of class: | class |
|---|---|
| Inherits from: | CoreObject |
| Version: | 12/01/06 |
| Author: | Aaron Clinger |
| Classpath: | org.casaframework.math.Percent |
| File last modified: | Monday, 29 January 2007, 16:19:56 |
Creates a standardized way of describing and storing percentages.
You can store and receive percentages in two different formats; regular percentage or as an decimal percentage.If percent is 37.5% a regular percentage would be expressed as
37.5 while the decimal percentage will be expressed .375.Example:
var boxWidthPer:Percent = new Percent(); this.boxWidthPer.setPercentage(25); this.box_mc._width *= boxWidthPer.getDecimalPercentage();
Summary
Constructor
Instance properties
Instance properties inherited from CoreObject
Instance methods
Instance methods inherited from CoreObject
Constructor
Percent
function Percent (
percentage:Number,
isDecimalPercentage:Boolean)
Creates a new percentage class with the option of defining the percent on creation.
Parameters:
percentage :
[optional] Percent formated at a percentage or an decimal percentage.
isDecimalPercentage:
[optional] Indicates if the parameter
percentage is a decimal percentage true, or regular percentage false; defaults to true.Instance methods
clone
function clone (
) : Percent
Returns:
A new percent object with the same value as this percent.
equals
function equals (
percent:Percent) : Boolean
Determines whether the percent specified in the
percent parameter is equal to this percent object.Parameters:
percent:
A defined Percent object.
Returns:
Returns
true if percents are identical; otherwise false.getDecimalPercentage
function getDecimalPercentage (
) : Number
Gets the percentage.
Returns:
Returns percent expressed as a decimal percentage. 37.5% would be returned as
.375.getPercentage
function getPercentage (
) : Number
Gets the percentage.
Returns:
Returns percent expressed as a regular percentage. 37.5% would be returned as
37.5.setDecimalPercentage
function setDecimalPercentage (
percent:Number) : Void
Sets the percentage.
Parameters:
percent:
Percent expressed as a decimal percentage. 37.5% would be expressed as
.375.setPercentage
function setPercentage (
percent:Number) : Void
Sets the percentage.
Parameters:
percent:
Percent expressed as a regular percentage. 37.5% would be expressed as
37.5.