Packagecom.adobe.portfolio.cards
Classpublic class CardFactory
InheritanceCardFactory Inheritance mx.core.ClassFactory

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The CardFactory class is a singleton that can be called to construct Cards and associated ItemRenderer functions.

You specify a generator class when you construct the cardFactory object. Then you set the properties property on the cardFactory object. Flex uses the factory object to generate instances by calling the cardFactory object's newInstance() method.

The newInstance() method creates a new instance of the generator class, and sets the properties specified by properties in the new instance. If you need to further customize the generated instances, you can override the newInstance() method.

The CardFactory class implements the IFactory interface. Therefore, it lets you create objects that can be assigned to properties of type IFactory, such as the itemRenderer property.



Public Methods
 MethodDefined By
  
CardFactory(cardType:String, defaultState:String = null, dropShadowPreference:String = null, rollOverPreference:String = null, alpha:Number = 1, enableThumbnailGeneration:Boolean = true, maintainAspectRatio:Boolean = false)
Returns new instances of the specified card type.
CardFactory
  
getItemRendererFunction(defaultType:String = BasicCard, defaultState:String = null, dropShadowPreference:String = null, rollOverPreference:String = null, alpha:Number = 1, enableThumbnailGeneration:Boolean = true, maintainAspectRatio:Boolean = false, supportFolder:Boolean = true):Function
[static] Returns a function that will provide an appropriate CardFactory based on a particular IAttachment.
CardFactory
Protected Methods
 MethodDefined By
  
getClassForType(cardType:String):Class
Returns the Class corresponding to a particular card type.
CardFactory
  
getStateForType(cardType:String, cardState:String):String
Returns the state string corresponding to a particular card type and state.
CardFactory
  
supportsBasicStates(cardType:String):Boolean
Returns true if the card class returned by this factory supports the basic card states.
CardFactory
Public Constants
 ConstantDefined By
  BASIC_CARD : String = BasicCard
[static] String literal used to represent a BasicCard value for the cardType when constructing a CardFactory.
CardFactory
  DROP_SHADOW_BOTTOM : String = bottom
[static] A string literal used to represent the preferred location, "bottom" of a dropshadow effect.
CardFactory
  DROP_SHADOW_NONE : String = none
[static] A string literal used to represent the preferred location, "none", of a dropshadow effect.
CardFactory
  DROP_SHADOW_REAR : String = rear
[static] A string literal used to represent the preferred location, "rear" of a dropshadow effect.
CardFactory
  FOLDER_CARD : String = FolderCard
[static] String literal used to represent a FolderCard value for the cardType when constructing a CardFactory.
CardFactory
  PREVIEW_CARD : String = PreviewCard
[static]
CardFactory
  ROLL_OVER_GLOW : String = glow
[static] String literal used to represent "glow" as the preferred type of rollover effect.
CardFactory
  ROLL_OVER_NONE : String = none
[static] String literal used to represent "none" as the preferred type of rollover effect.
CardFactory
  ROLL_OVER_SCALE : String = scale
[static] String literal used to represent "scale" as the preferred type of rollover effect.
CardFactory
  SIMPLE_CARD : String = SimpleCard
[static] String literal used to represent a SimpleCard value for the cardType when constructing a CardFactory.
CardFactory
  STATE_LARGE : String = large
[static]
CardFactory
  STATE_MEDIUM : String = medium
[static]
CardFactory
  STATE_SIMPLE : String = simple
[static] String literal used to represent a simple state value for the cardType when constructing a CardFactory.
CardFactory
  STATE_SMALL : String = small
[static]
CardFactory
Constructor Detail
CardFactory()Constructor
public function CardFactory(cardType:String, defaultState:String = null, dropShadowPreference:String = null, rollOverPreference:String = null, alpha:Number = 1, enableThumbnailGeneration:Boolean = true, maintainAspectRatio:Boolean = false)

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns new instances of the specified card type.

Parameters
cardType:String (default = NaN) — The type of card to create; default is a BasicCard
 
defaultState:String (default = null) — The initial state of the card
 
dropShadowPreference:String (default = null) — The preferred drop shadown effect. This is a string specifying the preferred location for a drop shadow effect on this component. This is used as a hint to skins when specifying filters.
 
rollOverPreference:String (default = null) — The preferred rollover effect: none, glow, or scale.
 
alpha:Number (default = 1) — The alpha value (transparency) of the card; the default is 1 (completely opaque)
 
enableThumbnailGeneration:Boolean (default = true) — If true (the default) then generate thumbnail images for the card.
 
maintainAspectRatio:Boolean (default = false) — If true then adjust the aspect ratio when rendering; default is false.
Method Detail
getClassForType()method
protected function getClassForType(cardType:String):Class

Returns the Class corresponding to a particular card type. Subclasses can override this function to provide support for alternative or additional card classes.

Parameters

cardType:String

Returns
Class
getItemRendererFunction()method 
public static function getItemRendererFunction(defaultType:String = BasicCard, defaultState:String = null, dropShadowPreference:String = null, rollOverPreference:String = null, alpha:Number = 1, enableThumbnailGeneration:Boolean = true, maintainAspectRatio:Boolean = false, supportFolder:Boolean = true):Function

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns a function that will provide an appropriate CardFactory based on a particular IAttachment. This returned function can be used as a dataGroup's itemRendererFunction.

Parameters

defaultType:String (default = BasicCard) — The type of card to be used for standard attachment types.
 
defaultState:String (default = null) — The initial state to be used for standard attachment types.
 
dropShadowPreference:String (default = null) — The preferred drop shadow effect. This is a string specifying the preferred location for a drop shadow effect on this component. This is used as a hint to skins when specifying filters.
 
rollOverPreference:String (default = null) — The preferred rollover effect: none, glow, or scale.
 
alpha:Number (default = 1) — The alpha value (transparency) of the item; the default is 1 (completely opaque)
 
enableThumbnailGeneration:Boolean (default = true) — If true (the default) then generate thumbnail images for the card
 
maintainAspectRatio:Boolean (default = false) — If true then adjust the aspect ratio when rendering; default is false
 
supportFolder:Boolean (default = true) — If true then folders are supported.

Returns
Function
getStateForType()method 
protected function getStateForType(cardType:String, cardState:String):String

Returns the state string corresponding to a particular card type and state.

Parameters

cardType:String
 
cardState:String

Returns
String — The state name string representing the given card state for the class indicated by the card type. The returned value may not match the given card state, or may be null if the state is unsupported by the given card type.

See also

supportsBasicStates()method 
protected function supportsBasicStates(cardType:String):Boolean

Returns true if the card class returned by this factory supports the basic card states.

Parameters

cardType:String

Returns
Boolean

See also

Constant Detail
BASIC_CARDConstant
public static const BASIC_CARD:String = BasicCard

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent a BasicCard value for the cardType when constructing a CardFactory.

DROP_SHADOW_BOTTOMConstant 
public static const DROP_SHADOW_BOTTOM:String = bottom

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A string literal used to represent the preferred location, "bottom" of a dropshadow effect.

See also

DROP_SHADOW_NONEConstant 
public static const DROP_SHADOW_NONE:String = none

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A string literal used to represent the preferred location, "none", of a dropshadow effect.

See also

DROP_SHADOW_REARConstant 
public static const DROP_SHADOW_REAR:String = rear

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A string literal used to represent the preferred location, "rear" of a dropshadow effect.

See also

FOLDER_CARDConstant 
public static const FOLDER_CARD:String = FolderCard

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent a FolderCard value for the cardType when constructing a CardFactory.

PREVIEW_CARDConstant 
public static const PREVIEW_CARD:String = PreviewCard

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

ROLL_OVER_GLOWConstant 
public static const ROLL_OVER_GLOW:String = glow

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent "glow" as the preferred type of rollover effect. This is used as a hint to skins when specifying filters.

See also

ROLL_OVER_NONEConstant 
public static const ROLL_OVER_NONE:String = none

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent "none" as the preferred type of rollover effect. This is used as a hint to skins when specifying filters.

See also

ROLL_OVER_SCALEConstant 
public static const ROLL_OVER_SCALE:String = scale

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent "scale" as the preferred type of rollover effect. This is used as a hint to skins when specifying filters.

See also

SIMPLE_CARDConstant 
public static const SIMPLE_CARD:String = SimpleCard

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent a SimpleCard value for the cardType when constructing a CardFactory.

STATE_LARGEConstant 
public static const STATE_LARGE:String = large

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

STATE_MEDIUMConstant 
public static const STATE_MEDIUM:String = medium

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

STATE_SIMPLEConstant 
public static const STATE_SIMPLE:String = simple

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

String literal used to represent a simple state value for the cardType when constructing a CardFactory.

STATE_SMALLConstant 
public static const STATE_SMALL:String = small

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0