
Model Data Class
class net.tolgaozdemir.games.slotmachine.data.SlotMachine {
private var strip_a:Number;
private var strip_b:Number;
private var strip_c:Number;
public var score:Number = 100;
public var bet:Number=2;
public var win:Number=0;
public function SlotMachine(a:Number, b:Number, c:Number) {
this.A = a;
this.B = b;
this.C = c;
}
public function set A(value:Number) {
this.strip_a = value;
}
public function get A():Number {
return this.strip_a;
}
public function set B(value:Number) {
this.strip_b = value;
}
public function get B():Number {
return this.strip_b;
}
public function set C(value:Number) {
this.strip_c = value;
}
public function get C():Number {
return this.strip_c;
}
public function toString():String{
return this.A + ","+ this.B + ","+ this.C;
}
}
As you can see, the class simply parametrize all variables in a slot machine. Now let’s see controller which controls the data and updates the view.
