/////////////////////////////////////////////////////////////////////////////////
// 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.view
{
import mx.flash.UIMovieClip;
public class ViewPip extends UIMovieClip
{
/////////////////////////////////////////////////////////////////////////////
// Instance Variables
/////////////////////////////////////////////////////////////////////////////
private var v_value: String;
/////////////////////////////////////////////////////////////////////////////
// Internal Attribute
/////////////////////////////////////////////////////////////////////////////
/** The value of the pip: "on" or "off". */
internal function get value(): String
{
return v_value;
}
[Inspectable (defaultValue="on", type="String", enumeration="on,off")]
internal 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 ViewPip(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
/////////////////////////////////////////////////////////////////////////////////