Package | mx.core |
Class | public class DeferredInstanceFromFunction |
Inheritance | DeferredInstanceFromFunction Object |
Implements | ITransientDeferredInstance |
Language Version : | ActionScript 3.0 |
Product Version : | Flex 3 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
getInstance()
method to
create an instance of an object when it is first needed and get
a reference to the object thereafter.
See also
Method | Defined By | ||
---|---|---|---|
DeferredInstanceFromFunction(generator:Function, destructor:Function = null)
Constructor. | DeferredInstanceFromFunction | ||
getInstance():Object
Returns a reference to an instance of the desired object. | DeferredInstanceFromFunction | ||
reset():void
Resets the state of our factory to the initial, uninitialized state. | DeferredInstanceFromFunction |
DeferredInstanceFromFunction | () | Constructor |
public function DeferredInstanceFromFunction(generator:Function, destructor:Function = null)
Language Version : | ActionScript 3.0 |
Product Version : | Flex 3 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
Constructor.
Parametersgenerator:Function — A function that creates and returns an instance
of the required object.
| |
destructor:Function (default = null ) — An optional function used to cleanup outstanding
references when reset() is called.
|
getInstance | () | method |
public function getInstance():Object
Language Version : | ActionScript 3.0 |
Product Version : | Flex 3 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
Returns a reference to an instance of the desired object.
If no instance of the required object exists, calls the function
specified in this class' generator
constructor parameter.
Object — An instance of the object.
|
reset | () | method |
public function reset():void
Language Version : | ActionScript 3.0 |
Product Version : | Flex 4 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
Resets the state of our factory to the initial, uninitialized state. The reference to our cached instance is cleared.