Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
A deferred instance factory that uses a generator function
to create an instance of the required object.
An application uses the
getInstance()
method to
create an instance of an object when it is first needed and get
a reference to the object thereafter.
public function DeferredInstanceFromFunction(generator:Function, destructor:Function = null)
Language Version: | ActionScript 3.0 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Constructor.
Parameters | generator:Function — A function that creates and returns an instance
of the required object.
|
|
| destructor:Function (default = null )
|
public function getInstance():Object
Language Version: | ActionScript 3.0 |
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.
Returns | Object — An instance of the object.
|
public function reset():void
Language Version: | ActionScript 4.0 |
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.
© 2009 Adobe Systems Incorporated. All rights reserved.
Sat Oct 3 2009, 04:15 AM -07:00