class CColor extends Object
Represents a RGB color
Various methods allow for manipulation of colors within the Mirell3D system.
- Usage:
myColor = new CColor(255,0,0); // Red Color
- Author:Mirell Development
- Version:1.0.0
Method Summary
Returns an excact copy of this color
Unserializes XML into the object
Retrives the amount of red in the color
Returns a new color instance of this color
Return the color as decimal value
Retrives the amount of green in the color
Retrieves the amount of red in the color
Sets the amount of blue in the color
Sets this color's RGB amounts
Sets this color's RGB values using a decimal value
Sets the amount of green in the color
Sets the amount of red in the color
Converts the specified object to a string and returns it.
Serializes the object into XML
Property Documentation
Constructor Documentation
CColor
public function CColor (
r: Number,
g: Number,
b: Number)
g: Number,
b: Number)
Constructs a new color object
- Usage:
new CColor(r: Number, g: Number, b: Number)
Method Documentation
clone
public function clone (
): CColor
Returns an excact copy of this color
- Returns:Copy of this color as a new instance
fromXML
public function fromXML (
value: XML): Void
Unserializes XML into the object
Object state is set according to XML.
- Specified by:fromXML in interface de.mirell.xml.serialization.IXMLSerializable
- Parameters:
value XML which represents the serialized form of the object
getColor
public function getColor (
): CColor
Returns a new color instance of this color
- Returns:New CColor with the same RGB amounts as this color
getColorValue
public function getColorValue (
): Number
Return the color as decimal value
- Returns:Returns the decimal color representation
getGreen
public function getGreen (
): Number
Retrives the amount of green in the color
- Returns:Green Amount
setBlue
public function setBlue (
value: Number): Void
Sets the amount of blue in the color
- Parameters:
value Blue Amount
setColor
public function setColor (
r: Number,
g: Number,
b: Number): CColor
g: Number,
b: Number): CColor
Sets this color's RGB amounts
- Parameters:
r Red Amount g Green Amount b Blue Amount - Returns:Returns a reference to itself
setColorValue
public function setColorValue (
value: Number): CColor
Sets this color's RGB values using a decimal value
- Parameters:
value A decimal value being used to populate the RGB values - Example:
myColor.setColorValue(0xFF0000); // Red color
setGreen
public function setGreen (
value: Number): Void
Sets the amount of green in the color
- Parameters:
value Green Amount
setRed
public function setRed (
value: Number): Void
Sets the amount of red in the color
- Parameters:
value Red Amount
toString
public function toString (
): String
Converts the specified object to a string and returns it.
- Overrides:Object.toString in class Object
- Returns:A string.
- Example:
trace(new myColor(255,0,0).toString()); // traces: "r:255,g:0,b:0"
toXML
public function toXML (
): XML
Serializes the object into XML
The current object state will be serialized. The fromXML method must be able to unserialize the XML.
- Specified by:toXML in interface de.mirell.xml.serialization.IXMLSerializable
- Returns:The XML which contains the serialized representation of the object
- CColor.as, Last Modified: 21.08.2004 22:31:36