Package | com.greensock.transform |
Class | public class TransformManager |
Inheritance | TransformManager flash.events.EventDispatcher |
FlexTransformManager
class that makes it simple to integrate into Flex applications.
var manager:TransformManager = new TransformManager({targetObjects:[mc1, mc2], forceSelectionToFront:true, bounds:new Rectangle(0, 0, 550, 450), allowDelete:true});
All TransformEvents have an "items" property which is an Array populated by the affected TransformItem instances. TransformEvents also have a "mouseEvent" property that will be populated if there was an associted MouseEvent (like CLICK_OFF)
import com.greensock.transform.TransformManager;
var manager:TransformManager = new TransformManager({targetObjects:[mc1, mc2]});
To make the two MovieClips transformable, constrain their scaling to be proportional (even if the user is not holding
down the shift key), call the onScale function everytime one of the objects is scaled, lock the rotation value of each
MovieClip (preventing rotation), and allow the delete key to appear to delete the selected MovieClip from the stage:
import com.greensock.transform.TransformManager;
import com.greensock.events.TransformEvent;
var manager:TransformManager = new TransformManager({targetObjects:[mc1, mc2], constrainScale:true, lockRotation:true, allowDelete:true, autoDeselect:true});
manager.addEventListener(TransformEvent.SCALE, onScale);
function onScale($e:TransformEvent):void {
trace("Scaled " + $e.items.length + " items");
}
To add mc1 and mc2 and myText after a TransformManager has been created, and then listen for when only mc1 is selected:
import com.greensock.transform.TransformManager;
import com.greensock.events.TransformEvent;
var manager:TransformManager = new TransformManager();
var mc1Item:TransformItem = manager.addItem(mc1);
var mc2Item:TransformItem = manager.addItem(mc2);
var myTextItem:TransformItem = manager.addItem(myText, TransformManager.SCALE_WIDTH_AND_HEIGHT, true);
mc1Item.addEventListener(TransformEvent.SELECT, onSelectClip1);
function onSelectClip1($e:TransformEvent):void {
trace("selected mc1");
}
Copyright 2010, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/eula.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
Property | Defined by | ||
---|---|---|---|
allowDelete : Boolean If true, when the user presses the DELETE (or BACKSPACE) key, the selected item(s) will be deleted (except items with
hasSelectableText set to true) [default: false ] | TransformManager | ||
allowMultiSelect : Boolean If true, multiple items can be selected by holding down the SHIFT or CONTROL keys and clicking [default:
true ] | TransformManager | ||
arrowKeysMove : Boolean If true, the arrow keys on the keyboard will move the selected items when pressed [default:
false ] | TransformManager | ||
autoDeselect : Boolean When the user clicks anywhere OTHER than on one of the TransformItems, all are deselected [default:
true ] | TransformManager | ||
bounds : Rectangle A Rectangle defining the boundaries for movement/scaling/rotation.
| TransformManager | ||
constrainScale : Boolean To constrain items to only scaling proportionally, set this to true [default:
false ] | TransformManager | ||
enabled : Boolean Enable or disable the entire TransformManager.
| TransformManager | ||
forceSelectionToFront : Boolean When true, new selections are forced to the front (top) of the display list [default:
true ] | TransformManager | ||
handleFillColor : uint Controls the fill color of the handle [default:
0xFFFFFF ] | TransformManager | ||
handleSize : Number Controls the handle size (in pixels) [default:
8 ] | TransformManager | ||
hideCenterHandle : Boolean To hide the center scale handle, set this to true [default:
false ] | TransformManager | ||
ignoredObjects : Array If you want TransformManager to ignore clicks on certain DisplayObjects like buttons, color pickers, etc., add them to the ignoredObjects Array.
| TransformManager | ||
isShowingCustomCursor : Boolean [read-only] If
true , TransformManager is currently displaying a custom cursor (like the scale, rotate, or move cursor). | TransformManager | ||
items : Array [read-only] All of the TransformItem instances that are managed by this TransformManager (regardless of whether or not they're selected)
| TransformManager | ||
lineColor : uint Controls the line color of the selection box and handles [default:
0x3399FF ] | TransformManager | ||
lockPosition : Boolean Prevents moving [default:
false ] | TransformManager | ||
lockRotation : Boolean Prevents rotating [default:
false ] | TransformManager | ||
lockScale : Boolean Prevents scaling [default:
false ] | TransformManager | ||
paddingForRotation : Number Determines the amount of space outside each of the four corner scale handles that will trigger rotation mode [default:
12 ] | TransformManager | ||
scaleFromCenter : Boolean If true, scaling occurs from the center of the selection instead of the corners.
| TransformManager | ||
selectedItems : Array The currently selected TransformItems (for the associated DisplayObjects, use
selectedTargetObjects ) | TransformManager | ||
selectedTargetObjects : Array The currently selected targetObjects (DisplayObjects).
| TransformManager | ||
selectionRotation : Number The rotation of the overall selection box
| TransformManager | ||
selectionScaleX : Number The scaleX of the overall selection box
| TransformManager | ||
selectionScaleY : Number The scaleY of the overall selection box
| TransformManager | ||
selectionX : Number The x-coordinte of the overall selection box (same as the origin)
| TransformManager | ||
selectionY : Number The y-coordinate of the overall selection box (same as the origin)
| TransformManager | ||
targetObjects : Array [read-only] All of the targetObjects (DisplayObjects) that are managed by this TransformManager (regardless of whether or not they're selected)
| TransformManager |
Method | Defined by | ||
---|---|---|---|
TransformManager($vars:Object = null)
Constructor
| TransformManager | ||
addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void
Allows listening for the following events:
| TransformManager | ||
addIgnoredObject($object:DisplayObject):void
Allows you to have TransformManager ignore clicks on a particular DisplayObject (handy for buttons, color pickers, etc.).
| TransformManager | ||
addItem($targetObject:DisplayObject, $scaleMode:String = "scaleNormal", $hasSelectableText:Boolean = false):TransformItem
In order for a DisplayObject to be managed by TransformManger, it must first be added via
addItem() . | TransformManager | ||
addItems($targetObjects:Array, $scaleMode:String = "scaleNormal", $hasSelectableText:Boolean = false):Array
Same as addItem() but accepts an Array containing multiple DisplayObjects.
| TransformManager | ||
applyFullXML(xml:XML, defaultParent:DisplayObjectContainer, placeholderColor:uint = 0xCCCCCC):Array
Applies XML generated by
exportFullXML() to the TransformManager instance including all settings
and each item's scale/rotation/position. | TransformManager | ||
applyItemXML(xml:XML, defaultParent:DisplayObjectContainer = null, placeholderColor:uint = 0xCCCCCC):DisplayObject
Applies XML generated by
exportItemXML() to the TransformManager instance including all transform
data like scale/rotation/position. | TransformManager | ||
applySettingsXML(xml:XML):void
Applies settings XML generated by
exportSettingsXML() to the TransformManager instance. | TransformManager | ||
deleteSelection($e:Event = null):void
Deletes all selected items.
| TransformManager | ||
deselectAll():void
Deselects all items
| TransformManager | ||
deselectItem($item:*):TransformItem
Deselects a TransformItem or DisplayObject.
| TransformManager | ||
destroy():void
Destroys the TransformManager instance, removing all items and preparing it for garbage collection
| TransformManager | ||
exportFullXML():XML
A common request is to capture the current state of each item's scale/rotation/position and the TransformManager's
settings in an easy-to-store format so that the data can be reloaded and applied later;
exportFullXML()
returns an XML object containing exactly that. | TransformManager | ||
exportItemXML(targetObject:DisplayObject):XML
Exports transform data (scale/rotation/position) of a particular DisplayObject in XML format so that
it can be saved to a database or elsewhere easily and then reapplied later.
| TransformManager | ||
exportSettingsXML():XML
Exports the TransformManager's settings in XML format so that it can be saved to a database or elsewhere easily
and then reapplied later.
| TransformManager | ||
flipSelectionHorizontal():void
Flips the selected items horizontally
| TransformManager | ||
flipSelectionVertical():void
Flips the selected items vertically
| TransformManager | ||
getItem($targetObject:DisplayObject):TransformItem
Gets the TransformItem associated with a particular DisplayObject (if any).
| TransformManager | ||
getSelectionBounds(targetCoordinateSpace:DisplayObject = null):Rectangle
Gets the bounding Rectangle of the current selection (not including handles)
| TransformManager | ||
getSelectionBoundsWithHandles(targetCoordinateSpace:DisplayObject = null):Rectangle
Gets the bounding Rectangle of the current selection (including handles)
| TransformManager | ||
getSelectionCenter():Point
Gets the center point of the current selection
| TransformManager | ||
getUnrotatedSelectionHeight():Number
Gets the height of the selection as if it were not rotated.
| TransformManager | ||
getUnrotatedSelectionWidth():Number
Gets the width of the selection as if it were not rotated.
| TransformManager | ||
isSelected($item:*):Boolean
Determines whether or not a particular DisplayObject or TranformItem is currently selected.
| TransformManager | ||
moveSelection($x:Number, $y:Number, $dispatchEvents:Boolean = true):void
Moves the selected items by a certain number of pixels on the x axis and y axis
| TransformManager | ||
moveSelectionDepthDown():void
Moves the selection down one level.
| TransformManager | ||
moveSelectionDepthUp():void
Moves the selection up one level.
| TransformManager | ||
removeAllItems():void
Removes all items from the TransformManager instance.
| TransformManager | ||
removeIgnoredObject($object:DisplayObject):void
Removes an ignored DisplayObject so that its clicks are no longer ignored.
| TransformManager | ||
removeItem($item:*):void
Removes an item.
| TransformManager | ||
rotateSelection($angle:Number, $dispatchEvents:Boolean = true):void
Rotates the selected items by a particular angle (in Radians).
| TransformManager | ||
scaleSelection($sx:Number, $sy:Number, $dispatchEvents:Boolean = true):void
Scales the selected items along the x- and y-axis using multipliers.
| TransformManager | ||
selectItem($item:*, $addToSelection:Boolean = false):TransformItem
Selects a particular TransformItem or DisplayObject (you must have already added the DisplayObject
to TransformManager in order for it to be selectable - use
addItem() for that)
| TransformManager | ||
selectItems($items:Array, $addToSelection:Boolean = false):Array
Selects an Array of TransformItems and/or DisplayObjects.
| TransformManager | ||
updateSelection($centerOrigin:Boolean = true):void
Refreshes the selection box/handles.
| TransformManager |
Constant | Defined by | ||
---|---|---|---|
SCALE_NORMAL : String = "scaleNormal" [static] Normal scale mode
| TransformManager | ||
SCALE_WIDTH_AND_HEIGHT : String = "scaleWidthAndHeight" [static] Scale only
width and height properties | TransformManager |
allowDelete | property |
allowDelete:Boolean
[read-write] If true, when the user presses the DELETE (or BACKSPACE) key, the selected item(s) will be deleted (except items with hasSelectableText
set to true) [default: false
]
public function get allowDelete():Boolean
public function set allowDelete(value:Boolean):void
allowMultiSelect | property |
allowMultiSelect:Boolean
[read-write] If true, multiple items can be selected by holding down the SHIFT or CONTROL keys and clicking [default: true
]
public function get allowMultiSelect():Boolean
public function set allowMultiSelect(value:Boolean):void
arrowKeysMove | property |
arrowKeysMove:Boolean
[read-write] If true, the arrow keys on the keyboard will move the selected items when pressed [default: false
]
public function get arrowKeysMove():Boolean
public function set arrowKeysMove(value:Boolean):void
autoDeselect | property |
autoDeselect:Boolean
[read-write] When the user clicks anywhere OTHER than on one of the TransformItems, all are deselected [default: true
]
public function get autoDeselect():Boolean
public function set autoDeselect(value:Boolean):void
bounds | property |
bounds:Rectangle
[read-write]A Rectangle defining the boundaries for movement/scaling/rotation. [default:null]
Implementation public function get bounds():Rectangle
public function set bounds(value:Rectangle):void
constrainScale | property |
constrainScale:Boolean
[read-write] To constrain items to only scaling proportionally, set this to true [default: false
]
public function get constrainScale():Boolean
public function set constrainScale(value:Boolean):void
enabled | property |
enabled:Boolean
[read-write]Enable or disable the entire TransformManager.
Implementation public function get enabled():Boolean
public function set enabled(value:Boolean):void
forceSelectionToFront | property |
forceSelectionToFront:Boolean
[read-write] When true, new selections are forced to the front (top) of the display list [default: true
]
public function get forceSelectionToFront():Boolean
public function set forceSelectionToFront(value:Boolean):void
handleFillColor | property |
handleFillColor:uint
[read-write] Controls the fill color of the handle [default: 0xFFFFFF
]
public function get handleFillColor():uint
public function set handleFillColor(value:uint):void
handleSize | property |
handleSize:Number
[read-write] Controls the handle size (in pixels) [default: 8
]
public function get handleSize():Number
public function set handleSize(value:Number):void
hideCenterHandle | property |
hideCenterHandle:Boolean
[read-write] To hide the center scale handle, set this to true [default: false
]
public function get hideCenterHandle():Boolean
public function set hideCenterHandle(value:Boolean):void
ignoredObjects | property |
ignoredObjects:Array
[read-write]If you want TransformManager to ignore clicks on certain DisplayObjects like buttons, color pickers, etc., add them to the ignoredObjects Array. The DisplayObject CANNOT be a child of a targetObject that is being managed by TransformManager.
Implementation public function get ignoredObjects():Array
public function set ignoredObjects(value:Array):void
isShowingCustomCursor | property |
isShowingCustomCursor:Boolean
[read-only] If true
, TransformManager is currently displaying a custom cursor (like the scale, rotate, or move cursor).
public function get isShowingCustomCursor():Boolean
items | property |
items:Array
[read-only]All of the TransformItem instances that are managed by this TransformManager (regardless of whether or not they're selected)
Implementation public function get items():Array
lineColor | property |
lineColor:uint
[read-write] Controls the line color of the selection box and handles [default: 0x3399FF
]
public function get lineColor():uint
public function set lineColor(value:uint):void
lockPosition | property |
lockPosition:Boolean
[read-write] Prevents moving [default: false
]
public function get lockPosition():Boolean
public function set lockPosition(value:Boolean):void
lockRotation | property |
lockRotation:Boolean
[read-write] Prevents rotating [default: false
]
public function get lockRotation():Boolean
public function set lockRotation(value:Boolean):void
lockScale | property |
lockScale:Boolean
[read-write] Prevents scaling [default: false
]
public function get lockScale():Boolean
public function set lockScale(value:Boolean):void
paddingForRotation | property |
paddingForRotation:Number
[read-write] Determines the amount of space outside each of the four corner scale handles that will trigger rotation mode [default: 12
]
public function get paddingForRotation():Number
public function set paddingForRotation(value:Number):void
scaleFromCenter | property |
scaleFromCenter:Boolean
[read-write] If true, scaling occurs from the center of the selection instead of the corners. [default: false
]
public function get scaleFromCenter():Boolean
public function set scaleFromCenter(value:Boolean):void
selectedItems | property |
selectedItems:Array
[read-write] The currently selected TransformItems (for the associated DisplayObjects, use selectedTargetObjects
)
public function get selectedItems():Array
public function set selectedItems(value:Array):void
selectedTargetObjects | property |
selectedTargetObjects:Array
[read-write] The currently selected targetObjects (DisplayObjects). For the associated TransformItems, use selectedItems
.
public function get selectedTargetObjects():Array
public function set selectedTargetObjects(value:Array):void
selectionRotation | property |
selectionRotation:Number
[read-write]The rotation of the overall selection box
Implementation public function get selectionRotation():Number
public function set selectionRotation(value:Number):void
selectionScaleX | property |
selectionScaleX:Number
[read-write]The scaleX of the overall selection box
Implementation public function get selectionScaleX():Number
public function set selectionScaleX(value:Number):void
selectionScaleY | property |
selectionScaleY:Number
[read-write]The scaleY of the overall selection box
Implementation public function get selectionScaleY():Number
public function set selectionScaleY(value:Number):void
selectionX | property |
selectionX:Number
[read-write]The x-coordinte of the overall selection box (same as the origin)
Implementation public function get selectionX():Number
public function set selectionX(value:Number):void
selectionY | property |
selectionY:Number
[read-write]The y-coordinate of the overall selection box (same as the origin)
Implementation public function get selectionY():Number
public function set selectionY(value:Number):void
targetObjects | property |
targetObjects:Array
[read-only]All of the targetObjects (DisplayObjects) that are managed by this TransformManager (regardless of whether or not they're selected)
Implementation public function get targetObjects():Array
TransformManager | () | constructor |
public function TransformManager($vars:Object = null)
Constructor
Parameters$vars:Object (default = null ) — An object specifying any properties that should be set upon instantiation, like {items:[mc1, mc2], lockRotation:true, bounds:new Rectangle(0, 0, 500, 300)} .
|
addEventListener | () | method |
public override function addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void
Allows listening for the following events:
$type:String — Event type
|
|
$listener:Function — Listener function
|
|
$useCapture:Boolean (default = false ) — Use capture phase
|
|
$priority:int (default = 0 ) — Priority
|
|
$useWeakReference:Boolean (default = false ) — Use weak reference
|
addIgnoredObject | () | method |
public function addIgnoredObject($object:DisplayObject):void
Allows you to have TransformManager ignore clicks on a particular DisplayObject (handy for buttons, color pickers, etc.). The DisplayObject CANNOT be a child of a targetObject
Parameters$object:DisplayObject — DisplayObject that should be ignored
|
addItem | () | method |
public function addItem($targetObject:DisplayObject, $scaleMode:String = "scaleNormal", $hasSelectableText:Boolean = false):TransformItem
In order for a DisplayObject to be managed by TransformManger, it must first be added via addItem()
. When the
DisplayObject is added, a TransformItem instance is automatically created and associated with the DisplayObject.
If you need to set item-specific settings like minScaleX, maxScaleX, etc., you would set those via the TransformItem
instance. addItem()
returns a TransformItem instance, but you can retrieve it anytime with the getItem()
method (just pass it your DisplayObject, like var myItem:TransformItem = myManager.getItem(myDisplayObject)
.
NOTE: If your targetObject isn't an InteractiveObject, it will not receive MouseEvents like clicks and rollovers that trigger
selection, dragging, cursor changes, etc. so user interaction-based actions won't be possible. That may be perfectly
acceptable, though, if you're going to do transformations directly via code.
$targetObject:DisplayObject — The DisplayObject to be managed
|
|
$scaleMode:String (default = "scaleNormal ") — Either TransformManager.SCALE_NORMAL for normal scaleX/scaleY scaling or TransformManager.SCALE_WIDTH_AND_HEIGHT if you prefer that TransformManager alters the width /height properties instead.
|
|
$hasSelectableText:Boolean (default = false ) — If true, this prevents dragging of the object unless clicking on the edges/border or center handle, and allows the DELETE key to be pressed without deleting the object itself. It will also force the scaleMode to TransformManager.SCALE_WIDTH_AND_HEIGHT .
|
TransformItem —
TransformItem instance
|
addItems | () | method |
public function addItems($targetObjects:Array, $scaleMode:String = "scaleNormal", $hasSelectableText:Boolean = false):Array
Same as addItem() but accepts an Array containing multiple DisplayObjects.
Parameters$targetObjects:Array — An Array of DisplayObject to be managed
|
|
$scaleMode:String (default = "scaleNormal ") — Either TransformManager.SCALE_NORMAL for normal scaleX/scaleY scaling or TransformManager.SCALE_WIDTH_AND_HEIGHT if you prefer that TransformManager alters the width /height properties instead.
|
|
$hasSelectableText:Boolean (default = false ) — If true, this prevents dragging of the objects unless clicking on the edges/border or center handle, and allows the DELETE key to be pressed without deleting the object itself. It will also force the scaleMode to TransformManager.SCALE_WIDTH_AND_HEIGHT .
|
Array — An Array of corresponding TransformItems that are created
|
applyFullXML | () | method |
public function applyFullXML(xml:XML, defaultParent:DisplayObjectContainer, placeholderColor:uint = 0xCCCCCC):Array
Applies XML generated by exportFullXML()
to the TransformManager instance including all settings
and each item's scale/rotation/position. This does not load any external images/assets - you must do that separately.
Typically it's best to fully load the assets first and add them to the display list before calling applyFullXML()
.
When applyFullXML()
is called, it attempts to find the targetObjects in the display list based on their names,
but for each one that cannot be found, a new Sprite will be created and added as a placeholder, filled with the
placeholderColor
and named identically. An array of those placeholders (if any) is returned by
applyFullXML()
which makes it easy to loop through and load your images/assets directly into those
placeholder Sprites. Feel free to add visual preloaders, alter the look of the Sprites, etc.
xml:XML — An XML object containing data about the settings and each item's position/scale/rotation. This XML is typically created using exportFullXML() .
|
|
defaultParent:DisplayObjectContainer — If no items have been added to the TransformManager yet, it won't know which DisplayObjectContainer to look in for targetObjects, so it is important to explicitly tell TransformManager what default parent to use.
|
|
placeholderColor:uint (default = 0xCCCCCC ) — If an item's targetObject cannot be found in the display list (based on its name), it will create a new Sprite and fill it with this color, using it as a placeholder.
|
Array — An array of placeholders that were created for missing targetObjects (if any). You can loop through these and load your assets accordingly. Keep in mind that the placeholders will have the same name as was defined in the XML (from the original targetObject).
|
See also
applyItemXML | () | method |
public function applyItemXML(xml:XML, defaultParent:DisplayObjectContainer = null, placeholderColor:uint = 0xCCCCCC):DisplayObject
Applies XML generated by exportItemXML()
to the TransformManager instance including all transform
data like scale/rotation/position. This does not load any external images/assets - you must do that separately.
Typically it's best to fully load the asset first and add them to the display list before calling applyItemXML()
.
When applyItemXML()
is called, it attempts to find the targetObject in the display list based on
its name, but if it cannot be found, a new Sprite will be created and added as a placeholder, filled with the
placeholderColor
and named identically. To load all of the settings and every item's transform
data, use applyFullXML()
instead.
xml:XML — An XML object containing data about the item's position/scale/rotation. This XML is typically created using exportItemXML() .
|
|
defaultParent:DisplayObjectContainer (default = null ) — If no items have been added to the TransformManager yet, it won't know which DisplayObjectContainer to look in for targetObject, so it is important to explicitly tell TransformManager what default parent to use.
|
|
placeholderColor:uint (default = 0xCCCCCC ) — If the targetObject cannot be found in the display list (based on its name), it will create a new Sprite and fill it with this color, using it as a placeholder.
|
DisplayObject — The DisplayObject associated with the item (a placeholder Sprite if the targeObject wasn't found in the display list).
|
See also
applySettingsXML | () | method |
public function applySettingsXML(xml:XML):void
Applies settings XML generated by exportSettingsXML()
to the TransformManager instance.
This determines things like allowDelete, autoDeselect, lockScale, lockPosition,
etc.
xml:XML — An XML object containing settings data about the TransformManager (typically exported by exportSettingsXML() ).
|
See also
deleteSelection | () | method |
public function deleteSelection($e:Event = null):void
Deletes all selected items.
Parameters$e:Event (default = null ) — Accepts an optional Event in case you want to use this as an event handler
|
deselectAll | () | method |
public function deselectAll():void
Deselects all items
deselectItem | () | method |
public function deselectItem($item:*):TransformItem
Deselects a TransformItem or DisplayObject.
Parameters$item:* — The TransformItem or DisplayObject that should be deselected
|
TransformItem —
The TransformItem that was deselected
|
destroy | () | method |
public function destroy():void
Destroys the TransformManager instance, removing all items and preparing it for garbage collection
exportFullXML | () | method |
public function exportFullXML():XML
A common request is to capture the current state of each item's scale/rotation/position and the TransformManager's
settings in an easy-to-store format so that the data can be reloaded and applied later; exportFullXML()
returns an XML object containing exactly that. The TransformManager's settings and each item's transform data is
stored in the following format:
XML — An XML representation of the current state of the TransformManager instance and all of the items it is managing.
|
See also
<transformManager> <settings allowDelete="1" allowMultiSelect="1" autoDeselect="1" constrainScale="0" lockScale="1" scaleFromCenter="0" lockRotation="0" lockPosition="0" arrowKeysMove="0" forceSelectionToFront="1" lineColor="3381759" handleColor="16777215" handleSize="8" paddingForRotation="12" hideCenterHandle="0"/> <items> <item name="mc1" level="1" a="0.9999847412109375" b="0" c="0" d="0.9999847412109375" tx="79.2" ty="150.5" xOffset="-23.4" yOffset="-34.35" rawWidth="128.6" rawHeight="110.69999999999999" scaleMode="scaleNormal" hasSelectableText="0" minScaleX="-Infinity" maxScaleX="Infinity" minScaleY="-Infinity" maxScaleY="Infinity"/> <item name="mc2" level="18" a="0.7987213134765625" b="0.2907257080078125" c="-0.2907257080078125" d="0.7987213134765625" tx="222.5" ty="92.25" xOffset="0" yOffset="0" rawWidth="287.85" rawHeight="215.8" scaleMode="scaleNormal" hasSelectableText="0" minScaleX="-Infinity" maxScaleX="Infinity" minScaleY="-Infinity" maxScaleY="Infinity"/> <item name="text_ti" level="4" a="1" b="0" c="0" d="1" tx="32" ty="303.95" xOffset="-2" yOffset="-2" rawWidth="188" rawHeight="37.2" scaleMode="scaleWidthAndHeight" hasSelectableText="1" minScaleX="-Infinity" maxScaleX="Infinity" minScaleY="-Infinity" maxScaleY="Infinity"/> </items> </transformManager>
exportItemXML | () | method |
public function exportItemXML(targetObject:DisplayObject):XML
Exports transform data (scale/rotation/position) of a particular DisplayObject in XML format so that
it can be saved to a database or elsewhere easily and then reapplied later. If you'd like to export all
settings and every item's data, use the exportFullXML()
instead. exportItemXML()
returns an XML object in the following format:
targetObject:DisplayObject — The DisplayObject whose transform data you'd like to export.
|
XML — An XML object describing the targetObject's transform data (scale/rotation/position) and a few other TransformManager-related settings.
|
See also
<item name="mc1" level="1" a="0.98" b="0" c="0" d="0.9" tx="79.2" ty="150.5" xOffset="-23.4" yOffset="-34.35" rawWidth="128.6" rawHeight="110.7" scaleMode="scaleNormal" hasSelectableText="0" minScaleX="-Infinity" maxScaleX="Infinity" minScaleY="-Infinity" maxScaleY="Infinity"/>
exportSettingsXML | () | method |
public function exportSettingsXML():XML
Exports the TransformManager's settings in XML format so that it can be saved to a database or elsewhere easily
and then reapplied later. exportSettingsXML()
returns an XML object in the following format:
XML — An XML object containing settings data about the TransformManager.
|
See also
<settings allowDelete="1" allowMultiSelect="1" autoDeselect="1" constrainScale="0" lockScale="1" scaleFromCenter="0" lockRotation="0" lockPosition="0" arrowKeysMove="0" forceSelectionToFront="1" lineColor="3381759" handleColor="16777215" handleSize="8" paddingForRotation="12" hideCenterHandle="0"/>
flipSelectionHorizontal | () | method |
public function flipSelectionHorizontal():void
Flips the selected items horizontally
flipSelectionVertical | () | method |
public function flipSelectionVertical():void
Flips the selected items vertically
getItem | () | method |
public function getItem($targetObject:DisplayObject):TransformItem
Gets the TransformItem associated with a particular DisplayObject (if any). This can be useful if you need to set item-specific properties like minScaleX/maxScaleX, etc.
Parameters$targetObject:DisplayObject — The DisplayObject with which the TransformItem is associated
|
TransformItem —
The associated TransformItem
|
getSelectionBounds | () | method |
public function getSelectionBounds(targetCoordinateSpace:DisplayObject = null):Rectangle
Gets the bounding Rectangle of the current selection (not including handles)
ParameterstargetCoordinateSpace:DisplayObject (default = null ) — The display object that defines the coordinate system to use.
|
Rectangle — Bounding Rectangle of the current selection (not including handles).
|
getSelectionBoundsWithHandles | () | method |
public function getSelectionBoundsWithHandles(targetCoordinateSpace:DisplayObject = null):Rectangle
Gets the bounding Rectangle of the current selection (including handles)
ParameterstargetCoordinateSpace:DisplayObject (default = null ) — The display object that defines the coordinate system to use.
|
Rectangle — Bounding Rectangle of the current selection (including handles)
|
getSelectionCenter | () | method |
public function getSelectionCenter():Point
Gets the center point of the current selection
ReturnsPoint — Center Point of the current selection
|
getUnrotatedSelectionHeight | () | method |
public function getUnrotatedSelectionHeight():Number
Gets the height of the selection as if it were not rotated.
ReturnsNumber — The unrotated selection height
|
getUnrotatedSelectionWidth | () | method |
public function getUnrotatedSelectionWidth():Number
Gets the width of the selection as if it were not rotated.
ReturnsNumber — The unrotated selection width
|
isSelected | () | method |
public function isSelected($item:*):Boolean
Determines whether or not a particular DisplayObject or TranformItem is currently selected.
Parameters$item:* — The TransformItem or DisplayObject whose selection status needs to be checked
|
Boolean — If true, the item/DisplayObject is currently selected
|
moveSelection | () | method |
public function moveSelection($x:Number, $y:Number, $dispatchEvents:Boolean = true):void
Moves the selected items by a certain number of pixels on the x axis and y axis
Parameters$x:Number — Number of pixels to move the selected items along the x-axis (can be negative or positive)
|
|
$y:Number — Number of pixels to move the selected items along the y-axis (can be negative or positive)
|
|
$dispatchEvents:Boolean (default = true ) — If false, no MOVE Events will be dispatched
|
moveSelectionDepthDown | () | method |
public function moveSelectionDepthDown():void
Moves the selection down one level.
moveSelectionDepthUp | () | method |
public function moveSelectionDepthUp():void
Moves the selection up one level.
removeAllItems | () | method |
public function removeAllItems():void
Removes all items from the TransformManager instance. This does NOT delete the items - it just prevents them from being affected by this TransformManager anymore.
removeIgnoredObject | () | method |
public function removeIgnoredObject($object:DisplayObject):void
Removes an ignored DisplayObject so that its clicks are no longer ignored.
Parameters$object:DisplayObject — DisplayObject that should not be ignored anymore
|
removeItem | () | method |
public function removeItem($item:*):void
Removes an item. Calling this on an item will NOT delete the DisplayObject - it just prevents it from being affected by this TransformManager anymore.
Parameters$item:* — Either the DisplayObject or the associated TransformItem that should be removed
|
rotateSelection | () | method |
public function rotateSelection($angle:Number, $dispatchEvents:Boolean = true):void
Rotates the selected items by a particular angle (in Radians). This is NOT an absolute value, so if one
of the selected items' rotation property is Math.PI and you rotateSelection(Math.PI)
, the new
angle would be Math.PI 2.
$angle:Number — Angle (in Radians) that should be added to the selected items' current rotation
|
|
$dispatchEvents:Boolean (default = true ) — If false, no ROTATE events will be dispatched
|
scaleSelection | () | method |
public function scaleSelection($sx:Number, $sy:Number, $dispatchEvents:Boolean = true):void
Scales the selected items along the x- and y-axis using multipliers. Keep in mind that these are not absolute values, so if a selected item's scaleX is 2 and you scaleSelection(2, 1), its new scaleX would be 4 because 2 2 = 4.
Parameters$sx:Number — Multiplier for scaling along the selection box's x-axis (which may or may not be the same as the selected item's y-axis, depending on whether or not multiple items are selected and if any are rotated)
|
|
$sy:Number — Multiplier for scaling along the selection box's y-axis (which may or may not be the same as the selected item's y-axis, depending on whether or not multiple items are selected and if any are rotated)
|
|
$dispatchEvents:Boolean (default = true ) — If false, no SCALE events will be dispatched
|
selectItem | () | method |
public function selectItem($item:*, $addToSelection:Boolean = false):TransformItem
Selects a particular TransformItem or DisplayObject (you must have already added the DisplayObject
to TransformManager in order for it to be selectable - use addItem()
for that)
$item:* — The TransformItem or DisplayObject that should be selected
|
|
$addToSelection:Boolean (default = false ) — If true, any currently selected items will remain selected and the new item/DisplayObject will be added to the selection.
|
TransformItem —
The TransformItem that was selected.
|
selectItems | () | method |
public function selectItems($items:Array, $addToSelection:Boolean = false):Array
Selects an Array of TransformItems and/or DisplayObjects. (you must have already added the DisplayObjects
to TransformManager in order for it to be selectable - use addItem()
or addItems()
for that)
$items:Array — An Array of TransformItems and/or DisplayObjects to be selected
|
|
$addToSelection:Boolean (default = false ) — If true, any currently selected items will remain selected and the new items/DisplayObjects will be added to the selection.
|
Array — An Array of TransformItems that were selected
|
updateSelection | () | method |
public function updateSelection($centerOrigin:Boolean = true):void
Refreshes the selection box/handles.
Parameters$centerOrigin:Boolean (default = true ) — If true, the origin (axis of rotation/scaling) will be automatically centered.
|
SCALE_NORMAL | constant |
public static const SCALE_NORMAL:String = "scaleNormal"
Normal scale mode
SCALE_WIDTH_AND_HEIGHT | constant |
public static const SCALE_WIDTH_AND_HEIGHT:String = "scaleWidthAndHeight"
Scale only width
and height
properties