mx.core

# ContextualClassFactory - AS3 Flex

Package | mx.core
Class | public class ContextualClassFactory
Inheritance | ContextualClassFactory ClassFactory Object

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

A class factory that provides a system manager as a context of where the class should be created.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | generator : Class The Class that the newInstance() method uses to generate objects from this factory object. | ClassFactory
|  | moduleFactory : IFlexModuleFactory The context in which an object should be created. | ContextualClassFactory
|  | properties : Object = null An Object whose name/value pairs specify the properties to be set on each object generated by the newInstance() method. | ClassFactory

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ContextualClassFactory(generator:Class = null, moduleFactory:IFlexModuleFactory = null) Constructor. | ContextualClassFactory
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | newInstance():* [override] Creates a new instance of the generator class, with the properties specified by properties. | ContextualClassFactory
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### moduleFactory

property

`public var moduleFactory:IFlexModuleFactory`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The context in which an object should be created.

This is used to solve using the embedded fonts in an application SWF when the framework is loaded as an RSL (the RSL has its own SWF context). Embedded fonts may only be accessed from the SWF file context in which they were created. By using the `systemManager` of the application SWF, the RSL can create objects in the application SWF context that will have access to the application's embedded fonts. `moduleFactory` will call `create()` to create an object in the context of the `moduleFactory`.

The default value is `null.`

Constructor Detail

### ContextualClassFactory

()
Constructor

`public function ContextualClassFactory(generator:Class = null, moduleFactory:IFlexModuleFactory = null)`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Constructor.

Parameters

| `generator:Class` (default = `null`)`` — The Class that the `newInstance()` method uses to generate objects from this factory object.
| `moduleFactory:IFlexModuleFactory` (default = `null`)`` — The system manager context in which the object should be created.

Method Detail

### newInstance

()
method

`override public function newInstance():*`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Creates a new instance of the `generator` class, with the properties specified by `properties`.

This method implements the `newInstance()` method of the IFactory interface.

Returns

| `*` — The new instance that was created.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00