Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
<colors> <color name="green" value="0x00FF00" /> <color name="grass" value="0x00FF00" /> <color name="red" value="0xFF0000"/></colors>
public class ColorProxy extends Proxy{ public static const NAME:String = "ColorProxy"; public function ColorProxy( xml:XML ) { super ( NAME, xml ); } // get the color value associated with the given color name public function getColorValueByName( name:String ):String { var elements:XMLList = xml..color.[@name==name]; return (elements.length > 0)?elements[0].@value.toString():''; } // get the first color name associated with the given color value public function getColorNameByValue( value:String ):String { var elements:XMLList = xml..color.[@value==value]; return (elements.length > 0)?elements[0].@name.toString():''; } protected function get xml():XML { return data as XML; } }}