Packageardisia.components.transformContainer
Classpublic class TransformContainer
InheritanceTransformContainer Inheritance spark.components.SkinnableContainer

Container that adds the ability to transform children by moving, scaling, skewing, and rotating.

Avoid anchor layouts on child elements.

Any element that implements IVisualElement can be added, but only elements that dispatch mouse events, like DisplayObjects, can be selected and transformed.

View the technical documentation on the Ardisia Labs website for more information.

Default MXML PropertymxmlContentFactory



Public Properties
 PropertyDefined By
  allowMultipleSelection : Boolean = true
True to allow the user to select multiple elements when the "ctrl" or "shift" key is down during selection.
TransformContainer
  dragEnabled : Boolean = true
True to enable element dragging.
TransformContainer
  excludedPips : Array
An array of the pips to not display over selected elements.
TransformContainer
  hoveredElement : IVisualElement
[read-only] The currently hovered visual element.
TransformContainer
  lockAspectRatio : Boolean = false
True lock the aspect ratio when transforming.
TransformContainer
  selectedElements : Vector.<IVisualElement>
A vector of the selected visual elements.
TransformContainer
  showHoverIndicator : Boolean
True to display the hoverIndicatorPart when mousing over child visual elements.
TransformContainer
  showSelectionIndicators : Boolean
True to display the selection indicators over selected elements.
TransformContainer
  transformMode : String
See the TransformModes class for possible values. "none" applies no transformation and does not display the transformation pips. "postScale" applies transform scaling to the selected element(s) after applying all other transformations.
TransformContainer
Public Methods
 MethodDefined By
  
Adds the selection indicators and transform pips to the selected elements.
TransformContainer
  
Clear out the selected elements and updates selection.
TransformContainer
Protected Methods
 MethodDefined By
  
contentGroupHandler(event:Event):void
Handles events for the content group skin part.
TransformContainer
  
elementHandler(event:Event):void
Handles events on elements added to this container.
TransformContainer
  
getPipName(pip:IVisualElement):String
Return the english description of which pip is passed.
TransformContainer
  
getTransformRectangle(targetSpace:DisplayObject):Rectangle
deprecated - use getTransformRectangle2() instead.
TransformContainer
  
getTransformRectangle2(targetSpace:IVisualElement):Rectangle
Return the transform lasso rectangle that bounds all the selected elements.
TransformContainer
  
handleSelection(element:IVisualElement, event:MouseEvent = null):void
Takes the passed element and the mouse event that occurred contextually in relation to the passed element and figures out how to adjust the selected elements.
TransformContainer
  
isElementSelected(element:IVisualElement):Boolean
Checks whether the passed element is in the selectedElements vector.
TransformContainer
  
mouseHandler(event:MouseEvent):void
Handles mouse event.
TransformContainer
  
removeAllDynamicParts(factory:String):void
Remove all instances of the passed dynamic part factory.
TransformContainer
  
removeCursorGroup(groupName:String):void
Remove the cursor group.
TransformContainer
  
Handles events related to element dragging.
TransformContainer
  
setCursorFromCSS(bitmapStyle:String, hotspotStyle:String, groupName:String, priority:Number):Boolean
Set the cursor based on a CSS style.
TransformContainer
  
setHover(currentHover:IVisualElement):void
Sets the hover indicator.
TransformContainer
  
setResizeCursor(name:String, priority:Number, groupName:String):void
Set the current cursor to the resize cursor.
TransformContainer
  
transformPipHandler(event:Event):void
Handles all transform events and transform dragging.
TransformContainer
Events
 Event Summary Defined By
  Dispatched when the selection changes.TransformContainer
  Dispatched when a visual element drag ends.TransformContainer
  Dispatched while a visual element is being dragged.TransformContainer
  Dispatched when a visual element drag begins.TransformContainer
  Dispatched when the hovered element changes.TransformContainer
  Dispatched when a transform ends.TransformContainer
  Dispatched when a transform is in progress.TransformContainer
  Dispatched when a transform begins.TransformContainer
Styles
 Style Description Defined By
  
borderAlpha
Type: Number CSS Inheritance: no
Border Alpha.
TransformContainer
  
borderColor
Type: uint Format: Color CSS Inheritance: no
Border color.
TransformContainer
  
borderVisible
Type: Boolean CSS Inheritance: no
True to display a border. The default value is true.
TransformContainer
  
moveCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to move layers. If not set, will use the DefaultCursor.
TransformContainer
  
moveCursorHotspot
Type: Array CSS Inheritance: no
The hot spot for the move cursor.
TransformContainer
  
rotateCursor
Type: Class CSS Inheritance: no
Embedded graphics class for the cursor used to rotate layers. If not set, will use the DefaultCursor.
TransformContainer
  
rotateCursorHotspot
Type: Array CSS Inheritance: no
The hot spot for the rotate cursor.
TransformContainer
Skin Parts

This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.


 Skin Part Description Defined By
  
hoverIndicatorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Indicator to display over hovered elements if the "showHoverIndicator" property is true.

The IFactory must return an object of type IVisualElement
TransformContainer
  
resizeCursorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Cursor to use for resize operations. Skin part to facilitate vector drawing for a better rotated appearance over a bitmap cursor. The hotspot is assumed to be in the center of the skin part. Will be displayed by the CursorManager class.

The IFactory must return an object of type IVisualElement
TransformContainer
  
selectionIndicatorFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Indicator to display over selected elements if the "showSelectionIndicators" property is true.

The IFactory must return an object of type IVisualElement
TransformContainer
  
transformPipFactoryPart:mx.core.IFactory
Required: true Part Type: Dynamic
Pip used to transform selected elements. Must be able to dispatch mouse events so a GraphicElement will not work. E.G. to use a Rect it must be wrapped in a EventDispatcher like a spark Group.

The IFactory must return an object of type InteractiveObject
TransformContainer
Property Detail
allowMultipleSelectionproperty
public var allowMultipleSelection:Boolean = true

True to allow the user to select multiple elements when the "ctrl" or "shift" key is down during selection.

The default value is true.

dragEnabledproperty 
public var dragEnabled:Boolean = true

True to enable element dragging.

The default value is true.

excludedPipsproperty 
excludedPips:Array

An array of the pips to not display over selected elements.

Only relevant if the "showSelectionIndicators" property is true.

The default value is null.


Implementation
    public function get excludedPips():Array
    public function set excludedPips(value:Array):void
hoveredElementproperty 
hoveredElement:IVisualElement  [read-only]

The currently hovered visual element.

The is property is bindable. Bound to the "hoveredElementChanged" event.

The default value is null.

This property can be used as the source for data binding.


Implementation
    public function get hoveredElement():IVisualElement
lockAspectRatioproperty 
public var lockAspectRatio:Boolean = false

True lock the aspect ratio when transforming.

The default value is false.

selectedElementsproperty 
selectedElements:Vector.<IVisualElement>

A vector of the selected visual elements.

The is property is bindable. Bound to the "change" event.

The default value is null.

This property can be used as the source for data binding.


Implementation
    public function get selectedElements():Vector.<IVisualElement>
    public function set selectedElements(value:Vector.<IVisualElement>):void
showHoverIndicatorproperty 
showHoverIndicator:Boolean

True to display the hoverIndicatorPart when mousing over child visual elements.

The default value is true.


Implementation
    public function get showHoverIndicator():Boolean
    public function set showHoverIndicator(value:Boolean):void
showSelectionIndicatorsproperty 
showSelectionIndicators:Boolean

True to display the selection indicators over selected elements.

The default value is true.


Implementation
    public function get showSelectionIndicators():Boolean
    public function set showSelectionIndicators(value:Boolean):void
transformModeproperty 
transformMode:String

See the TransformModes class for possible values.

"none" applies no transformation and does not display the transformation pips.

"postScale" applies transform scaling to the selected element(s) after applying all other transformations. This mode can add large amounts of skew to transformed elements.

"preScale" mode applies scaling before applying any other transformations and does not change the element's skew.

"explicit" applies changes in size to explicit width and height values. "explicit" is useful for text or containers when distortion is not desired. The element's scaling is not changed and the element's minWidth, maxWidth, minHeight, and maxHeight settings will be respected.

"postScale" allows the user to skew elements while "preScale" and "explicit" mode will not add additional skew.

NOTE: this property is irrelevant if multiple elements are selected. If multiple elements are selected, the "postScale" transformMode is applied automatically.

The default value is "preScale".


Implementation
    public function get transformMode():String
    public function set transformMode(value:String):void
Method Detail
applySelection()method
public function applySelection():void

Adds the selection indicators and transform pips to the selected elements.

clearSelection()method 
public function clearSelection():void

Clear out the selected elements and updates selection.

contentGroupHandler()method 
protected function contentGroupHandler(event:Event):void

Handles events for the content group skin part.

Parameters

event:Event — the Event that triggered the handler

elementHandler()method 
protected function elementHandler(event:Event):void

Handles events on elements added to this container.

Parameters

event:Event — the Event that triggered this handler

getPipName()method 
protected function getPipName(pip:IVisualElement):String

Return the english description of which pip is passed.

Parameters

pip:IVisualElement — the Pip

Returns
String — the String english text description of the pip
getTransformRectangle()method 
protected function getTransformRectangle(targetSpace:DisplayObject):Rectangle

deprecated - use getTransformRectangle2() instead. getBounds() isn't terribly reliable.

Returns the transform lasso rectangle that bounds all the selected elements.

Parameters

targetSpace:DisplayObject

Returns
Rectangle — Rectangle
getTransformRectangle2()method 
protected function getTransformRectangle2(targetSpace:IVisualElement):Rectangle

Return the transform lasso rectangle that bounds all the selected elements.

Improved version of getTransformRectangle2(). Does not use getBounds().

Parameters

targetSpace:IVisualElement — the coordinate space to use

Returns
Rectangle — Rectangle
handleSelection()method 
protected function handleSelection(element:IVisualElement, event:MouseEvent = null):void

Takes the passed element and the mouse event that occurred contextually in relation to the passed element and figures out how to adjust the selected elements.

Parameters

element:IVisualElement — the IVisualElement acted upon by a Mouse Event
 
event:MouseEvent (default = null) — the MouseEvent that acted on the IVisualElement

isElementSelected()method 
protected function isElementSelected(element:IVisualElement):Boolean

Checks whether the passed element is in the selectedElements vector.

Parameters

element:IVisualElement — the IVisualElement to check

Returns
Boolean — a Boolean
mouseHandler()method 
protected function mouseHandler(event:MouseEvent):void

Handles mouse event.

Parameters

event:MouseEvent — the MouseEvent that triggered the handler

removeAllDynamicParts()method 
protected function removeAllDynamicParts(factory:String):void

Remove all instances of the passed dynamic part factory.

Parameters

factory:String — the name of the factory

removeCursorGroup()method 
protected function removeCursorGroup(groupName:String):void

Remove the cursor group.

Parameters

groupName:String

selectedElementDraggingHandler()method 
protected function selectedElementDraggingHandler(event:Event):void

Handles events related to element dragging.

Parameters

event:Event — the Event that triggered the handler

setCursorFromCSS()method 
protected function setCursorFromCSS(bitmapStyle:String, hotspotStyle:String, groupName:String, priority:Number):Boolean

Set the cursor based on a CSS style.

Parameters

bitmapStyle:String — the css style to retrieve the bitmap asset
 
hotspotStyle:String — the css style hotspot for the bitmap asset
 
groupName:String — the groupName to apply to the cursor
 
priority:Number

Returns
Boolean — true is cursor successfully changed
setHover()method 
protected function setHover(currentHover:IVisualElement):void

Sets the hover indicator.

Parameters

currentHover:IVisualElement — the IVisualElement that is currently hovered

setResizeCursor()method 
protected function setResizeCursor(name:String, priority:Number, groupName:String):void

Set the current cursor to the resize cursor. Wil change the angle to reflect the moused pip.

Parameters

name:String
 
priority:Number
 
groupName:String

transformPipHandler()method 
protected function transformPipHandler(event:Event):void

Handles all transform events and transform dragging.

Parameters

event:Event — the Event that triggered the handler

Event Detail
change Event
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when the selection changes.

elementDragEnd Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when a visual element drag ends.

elementDragging Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched while a visual element is being dragged.

elementDragStart Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when a visual element drag begins.

hoveredElementChanged Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event

Dispatched when the hovered element changes.

transformDragEnd Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when a transform ends.

transformDragging Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when a transform is in progress.

transformDragStart Event  
Event Object Type: ardisia.components.transformContainer.events.TransformContainerEvent
TransformContainerEvent.type property = ardisia.components.transformContainer.events.TransformContainerEvent

Dispatched when a transform begins.