Entites that need initial configuration, e.g. after purchase from the catalog, may
find this class useful. It looks up a configuration entry by key in the entity's
memory, and if it does not find the entry, waits for a mouse click on the entity's
sprite.
The click pops up a configuration pane which asks for the value, which is then set
in entity memory so nobody ever sees the popup again.
protected var _configured:Function
protected var _control:EntityControl
protected var _key:String
public function Configurator(control:EntityControl, sprite:DisplayObject, key:String, configured:Function)Parameters
| control:EntityControl |
| |
| sprite:DisplayObject |
| |
| key:String |
| |
| configured:Function |
protected function handleClick(evt:MouseEvent):voidParameters
public static function requestEntry(control:EntityControl, sprite:DisplayObject, key:String, configured:Function):void
Gets the requested configuration entry from entity memory or failing that, from
the user; whenever the value (which is a String) is safely in hand, the callback
is executed with it, and the entity may continue setting itself up.
Parameters
| control:EntityControl |
| |
| sprite:DisplayObject |
| |
| key:String |
| |
| configured:Function |
protected static const PADDING:int = 10
protected static const WIDTH:int = 200