///////////////////////////////////////////////////////////////////////////////// // Copyright © 2008-2010 W. Kowarschick // // Permission is granted to copy, distribute and/or modify this document // under the terms of the WK License, Version 1.0 (WKL 1.0) or any later version // published by Wolfgang Kowarschick. ///////////////////////////////////////////////////////////////////////////////// package die { import flash.display.MovieClip; /** * This MovieClip displays a pip (of a dice; German: Würfelauge). *
A pip has two values: "on" (visible) and "off" (not visible).
* * @author Wolfgang Kowarschick * @category Class * @langversion 3.0 */ public class Pip extends MovieClip { ///////////////////////////////////////////////////////////////////////////// // Instance Variables ///////////////////////////////////////////////////////////////////////////// private var v_value: String; ///////////////////////////////////////////////////////////////////////////// // (Public) Attributes ///////////////////////////////////////////////////////////////////////////// /** The value of the pip: "on" or "off". */ public function get value(): String { return v_value; } [Inspectable (defaultValue="on", type="String", enumeration="on,off")] public function set value(p_value: String): void { // Integrity check! if (p_value != "on" && p_value != "off") throw (new Error ("Wrong pip value: " + p_value)); v_value = p_value; this.visible = (v_value == "on"); /* if (v_value == "on") this.alpha = 1; else this.alpha = 0.1; */ } ///////////////////////////////////////////////////////////////////////////// // Constructor ///////////////////////////////////////////////////////////////////////////// /** * Creates a new pip. * * @param p_value The initial value of the pip: "on" or "off". */ public function Pip(p_value: String = "on") { super(); value = p_value; // p_value is stored AND displayed!!! } ///////////////////////////////////////////////////////////////////////////// // Tracing ///////////////////////////////////////////////////////////////////////////// /** * Converts a WK_Pip object into a string. * * @return Returns the class, the object name and the value * (on or off) of the current pip.
*/
override public function toString(): String
{
return "WK_Pip '" + name + "': " + value;
}
/////////////////////////////////////////////////////////////////////////////
// EOC
/////////////////////////////////////////////////////////////////////////////
}
}
/////////////////////////////////////////////////////////////////////////////////
// EOF
/////////////////////////////////////////////////////////////////////////////////