Encapsulates the access and schema information for maintaining a fixed size array of integers
on a whirled game server using NetSubControl.
protected var _default:int
protected var _gameCtrl:GameControl
protected var _length:int
length:int [read-only]
Access the fixed length of the array.
Implementation
public function get length():int
protected var _name:String
net:NetSubControl [read-only]Implementation
protected function get net():NetSubControl
public function NetArray(gameCtrl:GameControl, name:String, length:int, defaultValue:int = 0) Creates a new net array.
Parameters
| gameCtrl:GameControl — the Top-level game controller for the game using this array
|
| |
| name:String — the name of the server-side array
|
| |
| length:int — the number of entries in the array
|
| |
| defaultValue:int (default = 0) — the optional value to use when populating or proxying an array |
public function forEach(fn:Function):void Call the given function on each element of the array. If the resest method has not been
called or has not completed its network round trip, does nothing.
Parameters
public function getAt(idx:int):int Gets the integer at the given index. If the array has not yet been created, returns the
default value. This behavior is necessary since views of a game may need to be created
prior to the completion of the round trip of the reset method call.
Parameters
Returns
public function increment(idx:int, amount:int):void Adds an integer amount to the value at the given index. If the reset method has not been
called or has not completed its network round trip, an exception will be thrown (by
NetSubControl).
Parameters
public function indexOf(value:int):int Returns the index of the given value in the array, or -1 if not present.
Parameters
Returns
public function reset():void Resets the contents of the array so that it has the given length and is filled with the
default value. This should normally be called early on in a game by the controlling
client.
public function setAt(idx:int, value:int):void Sets the integer at the given index. If the reset method has not been called or has not
completed its network round trip, an exception will be thrown (by NetSubControl).
Parameters