Packagecom.whirled
Classpublic class AbstractControl
InheritanceAbstractControl Inheritance flash.events.EventDispatcher
SubclassesAbstractSubControl, AVRGameControl, AVRServerGameControl, EntityControl, GameControl

The abstract base class for all controls and subcontrols.



Public Methods
 MethodDefined by
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
AbstractControl
  
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server together.
AbstractControl
  
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just loaded up our SWF by itself?
AbstractControl
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
AbstractControl
Events
 EventSummaryDefined by
   Event.UNLOAD Dispatched when the SWF using this control has been unloaded.AbstractControl
Method detail
addEventListener()method
public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an event listener.

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)
doBatch()method 
public function doBatch(fn:Function, ... args):void

Execute the specified function as a batch of commands that will be sent to the server together. Messages can be sent no faster than a rate of 10 per second. Using doBatch groups a number of set or sendMessage operations so that they are treated as a single unit towards this limit. For best performance, it should be used whenever a number of values are being set at once.

Parameters
fn:Function
 
... args

Example
     _ctrl.doBatch(function () :void {
         _ctrl.net.set("board", new Array(100));
         _ctrl.net.set("scores", new Dictionary());
         _ctrl.net.set("captures", 0);
     });
     
Note that it guarantees that those events get processed by the server as a unit, but the results will not come back as a unit. So, for instance, when you receive the PropertyChangedEvent for "board", checking the value of "scores" will still return the old value. It is NOT an error to call doBatch again from within the function passed to doBatch. All batched messages will be sent when the outermost doBatch function completes.

isConnected()method 
public function isConnected():Boolean

Are we connected and running inside the whirled environment, or has someone just loaded up our SWF by itself?

Returns
Boolean
removeEventListener()method 
public override function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Unregisters an event listener.

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
Event detail
unloadevent 
Event object type: flash.events.Event

Event.UNLOAD Dispatched when the SWF using this control has been unloaded. You should clean-up any resources that would otherwise stick around, like stopping any Timers, cancelling any sound streams, etc.