Adobe® Flex® 4 Language Reference
Hide Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
mx.core 
DeferredInstanceFromFunction 
Packagemx.core
Classpublic class DeferredInstanceFromFunction
InheritanceDeferredInstanceFromFunction Inheritance Object
Implements ITransientDeferredInstance

Language Version: ActionScript 3.0
Product Version: Flex 3
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.

See also



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
DeferredInstanceFromFunction(generator:Function, destructor:Function = null)
Constructor.
DeferredInstanceFromFunction
  
Returns a reference to an instance of the desired object.
DeferredInstanceFromFunction
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
Resets the state of our factory to the initial, uninitialized state.
DeferredInstanceFromFunction
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Constructor Detail

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.

Parameters
generator:Function — A function that creates and returns an instance of the required object.
 
destructor:Function (default = null)
Method Detail

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.

Returns
Object — An instance of the object.

reset

()method 
public function reset():void

Language Version: ActionScript 4.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.