Packagewk.example.die.model
Classpublic class ModelDie
InheritanceModelDie Inheritance wk.mvcs.model.WK_Model_CS
Implements IModelDie



Public Properties
 PropertyDefined By
  state : String
[read-only] The state of the die: ROLLING, i.e., the die is currently rolling, or THROWN, i.e., the die has been thrown and until the next throw the value does not change, or NO_VALUE, i.e.
ModelDie
  value : uint
The value of the die: 1 ..
ModelDie
Public Methods
 MethodDefined By
  
ModelDie
  
rollTheDie():void
If the die is currently not ROLLING, it starts ROLLING.
ModelDie
Property Detail
stateproperty
state:String  [read-only]

The state of the die: ROLLING, i.e., the die is currently rolling, or THROWN, i.e., the die has been thrown and until the next throw the value does not change, or NO_VALUE, i.e. the die is in a box and no value (0, to be more precisely) is displayed.


Implementation
    public function get state():String
valueproperty 
value:uint

The value of the die: 1 .. 6 and 0 (when state == NO_VALUE). It can only be set if the die currently is not ROLLING.


Implementation
    public function get value():uint
    public function set value(value:uint):void
Constructor Detail
ModelDie()Constructor
public function ModelDie()



Method Detail
rollTheDie()method
public function rollTheDie():void

If the die is currently not ROLLING, it starts ROLLING. For NUMBER_OF_ROLLS times (with a delay time of DELAY ms after each roll) a new random value is computed for the die. Thereafter the state is switched to THROWN.