| Package | com.greensock.transform |
| Class | public class TransformItem |
| Inheritance | TransformItem flash.events.EventDispatcher |
getItem()
method to get the TransformItem instance associated with a particular DisplayObject anytime
after it is added to the TransformManager instance, like:
var myItem:TransformItem = myManager.getItem(myObject);
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 while this item is selected, it will be deleted (unless
hasSelectableText is set to true) [default: false] | TransformItem | ||
| alpha : Number alpha
| TransformItem | ||
| center : Point [read-only] Center point (according to the DisplayObject.parent's coordinate space
| TransformItem | ||
| constrainScale : Boolean To constrain the item so that it only scales proportionally, set this to true [default:
false] | TransformItem | ||
| enabled : Boolean Enable or disable the TransformItem.
| TransformItem | ||
| hasSelectableText : Boolean 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.
| TransformItem | ||
| hasSizeLimits : Boolean [read-only] Reflects whether or not minScaleX, maxScaleX, minScaleY, or maxScaleY have been set.
| TransformItem | ||
| height : Number height
| TransformItem | ||
| innerCenter : Point [read-only] Center point according to the local coordinate space
| TransformItem | ||
| lockPosition : Boolean Prevents moving
| TransformItem | ||
| lockRotation : Boolean Prevents rotating
| TransformItem | ||
| lockScale : Boolean Prevents scaling
| TransformItem | ||
| maxHeight : Number Maximum height (measured as if the object was unrotated).
| TransformItem | ||
| maxScale : Number [write-only] Maximum scale (affects both the maxScaleX and maxScaleY properties)
| TransformItem | ||
| maxScaleX : Number Maximum scaleX
| TransformItem | ||
| maxScaleY : Number Maximum scaleY
| TransformItem | ||
| maxWidth : Number Maximum width (measured as if the object was unrotated).
| TransformItem | ||
| minHeight : Number Minimum height (measured as if the object was unrotated).
| TransformItem | ||
| minScale : Number [write-only] Minimum scale (affects both the minScaleX and minScaleY properties)
| TransformItem | ||
| minScaleX : Number Minimum scaleX
| TransformItem | ||
| minScaleY : Number Minimum scaleY
| TransformItem | ||
| minWidth : Number Minimum width (measured as if the object was unrotated).
| TransformItem | ||
| origin : Point Point that serves as the origin for scaling or axis of rotation
| TransformItem | ||
| rotation : Number rotation
| TransformItem | ||
| scaleMode : String 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. | TransformItem | ||
| scaleX : Number scaleX
| TransformItem | ||
| scaleY : Number scaleY
| TransformItem | ||
| selected : Boolean selected state of the item
| TransformItem | ||
| targetObject : DisplayObject [read-only] The associated DisplayObject
| TransformItem | ||
| width : Number width
| TransformItem | ||
| x : Number x-coordinate
| TransformItem | ||
| y : Number y-coordinate
| TransformItem | ||
| Method | Defined by | ||
|---|---|---|---|
|
TransformItem($targetObject:DisplayObject, $vars:Object)
Constructor
| TransformItem | ||
|
addEventListener($type:String, $listener:Function, $useCapture:Boolean = false, $priority:int = 0, $useWeakReference:Boolean = false):void
Allows listening for the following events:
| TransformItem | ||
|
deleteObject():void
Deletes the DisplayObject (removing it from the display list)
| TransformItem | ||
|
destroy():void
Destroys the TransformItem instance, preparing for garbage collection
| TransformItem | ||
|
fitInsideBounds(move:Boolean = true, updateFirst:Boolean = true, customBounds:Rectangle = null):void
Immediately applies bounds to the targetObject, forcing it to stay within the bounds
by scaling it down (if necessary) and optionally moving it as well.
| TransformItem | ||
|
move($x:Number, $y:Number, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):void
Moves the selected items by a certain number of pixels on the x axis and y axis
| TransformItem | ||
|
rotate($angle:Number, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):void
Rotates the item by a particular angle (in Radians).
| TransformItem | ||
|
scale($sx:Number, $sy:Number, $angle:Number = 0, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):void
Scales the item along the x- and y-axis using multipliers.
| TransformItem | ||
|
setScaleConstraints($minScaleX:Number, $maxScaleX:Number, $minScaleY:Number, $maxScaleY:Number):void
Sets minimum scaleX, maximum scaleX, minimum scaleY, and maximum scaleY
| TransformItem | ||
| allowDelete | property |
allowDelete:Boolean [read-write] If true, when the user presses the DELETE (or BACKSPACE) key while this item is selected, it will be deleted (unless hasSelectableText is set to true) [default: false]
public function get allowDelete():Boolean
public function set allowDelete(value:Boolean):void
| alpha | property |
alpha:Number [read-write]alpha
Implementation public function get alpha():Number
public function set alpha(value:Number):void
| center | property |
center:Point [read-only]Center point (according to the DisplayObject.parent's coordinate space
Implementation public function get center():Point
| constrainScale | property |
constrainScale:Boolean [read-write] To constrain the item so that it only scales 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 TransformItem.
Implementation public function get enabled():Boolean
public function set enabled(value:Boolean):void
| hasSelectableText | property |
hasSelectableText:Boolean [read-write] 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.
public function get hasSelectableText():Boolean
public function set hasSelectableText(value:Boolean):void
| hasSizeLimits | property |
hasSizeLimits:Boolean [read-only]Reflects whether or not minScaleX, maxScaleX, minScaleY, or maxScaleY have been set.
Implementation public function get hasSizeLimits():Boolean
| height | property |
height:Number [read-write]height
Implementation public function get height():Number
public function set height(value:Number):void
| innerCenter | property |
innerCenter:Point [read-only]Center point according to the local coordinate space
Implementation public function get innerCenter():Point
| lockPosition | property |
lockPosition:Boolean [read-write]Prevents moving
Implementation public function get lockPosition():Boolean
public function set lockPosition(value:Boolean):void
| lockRotation | property |
lockRotation:Boolean [read-write]Prevents rotating
Implementation public function get lockRotation():Boolean
public function set lockRotation(value:Boolean):void
| lockScale | property |
lockScale:Boolean [read-write]Prevents scaling
Implementation public function get lockScale():Boolean
public function set lockScale(value:Boolean):void
| maxHeight | property |
maxHeight:Number [read-write]Maximum height (measured as if the object was unrotated). Default is Infinity.
Implementation public function get maxHeight():Number
public function set maxHeight(value:Number):void
| maxScale | property |
maxScale:Number [write-only]Maximum scale (affects both the maxScaleX and maxScaleY properties)
Implementation public function set maxScale(value:Number):void
| maxScaleX | property |
maxScaleX:Number [read-write]Maximum scaleX
Implementation public function get maxScaleX():Number
public function set maxScaleX(value:Number):void
| maxScaleY | property |
maxScaleY:Number [read-write]Maximum scaleY
Implementation public function get maxScaleY():Number
public function set maxScaleY(value:Number):void
| maxWidth | property |
maxWidth:Number [read-write]Maximum width (measured as if the object was unrotated). Default is Infinity.
Implementation public function get maxWidth():Number
public function set maxWidth(value:Number):void
| minHeight | property |
minHeight:Number [read-write]Minimum height (measured as if the object was unrotated). Default is 1 (and cannot be less than 1).
Implementation public function get minHeight():Number
public function set minHeight(value:Number):void
| minScale | property |
minScale:Number [write-only]Minimum scale (affects both the minScaleX and minScaleY properties)
Implementation public function set minScale(value:Number):void
| minScaleX | property |
minScaleX:Number [read-write]Minimum scaleX
Implementation public function get minScaleX():Number
public function set minScaleX(value:Number):void
| minScaleY | property |
minScaleY:Number [read-write]Minimum scaleY
Implementation public function get minScaleY():Number
public function set minScaleY(value:Number):void
| minWidth | property |
minWidth:Number [read-write]Minimum width (measured as if the object was unrotated). Default is 1 (and cannot be less than 1).
Implementation public function get minWidth():Number
public function set minWidth(value:Number):void
| origin | property |
origin:Point [read-write]Point that serves as the origin for scaling or axis of rotation
Implementation public function get origin():Point
public function set origin(value:Point):void
| rotation | property |
rotation:Number [read-write]rotation
Implementation public function get rotation():Number
public function set rotation(value:Number):void
| scaleMode | property |
scaleMode:String [read-write] 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.
public function get scaleMode():String
public function set scaleMode(value:String):void
| scaleX | property |
scaleX:Number [read-write]scaleX
Implementation public function get scaleX():Number
public function set scaleX(value:Number):void
| scaleY | property |
scaleY:Number [read-write]scaleY
Implementation public function get scaleY():Number
public function set scaleY(value:Number):void
| selected | property |
selected:Boolean [read-write]selected state of the item
Implementation public function get selected():Boolean
public function set selected(value:Boolean):void
| targetObject | property |
targetObject:DisplayObject [read-only]The associated DisplayObject
Implementation public function get targetObject():DisplayObject
| width | property |
width:Number [read-write]width
Implementation public function get width():Number
public function set width(value:Number):void
| x | property |
x:Number [read-write]x-coordinate
Implementation public function get x():Number
public function set x(value:Number):void
| y | property |
y:Number [read-write]y-coordinate
Implementation public function get y():Number
public function set y(value:Number):void
| TransformItem | () | constructor |
public function TransformItem($targetObject:DisplayObject, $vars:Object)Constructor
Parameters$targetObject:DisplayObject — DisplayObject to be managed
|
|
$vars:Object — An object specifying any properties that should be set upon instantiation, like {constrainScale:true, 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):voidAllows 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
|
| deleteObject | () | method |
public function deleteObject():voidDeletes the DisplayObject (removing it from the display list)
| destroy | () | method |
public function destroy():voidDestroys the TransformItem instance, preparing for garbage collection
| fitInsideBounds | () | method |
public function fitInsideBounds(move:Boolean = true, updateFirst:Boolean = true, customBounds:Rectangle = null):void
Immediately applies bounds to the targetObject, forcing it to stay within the bounds
by scaling it down (if necessary) and optionally moving it as well. If, for example, the targetObject
is much larger than the bounds, it will be scaled down to fit within them. If it is positioned outside
the bounds, fitInsideBounds(true) will move it only as much as is necessary for it to fit within
the bounds. Applying bounds with fitInsideBounds() is NOT the same thing as
setting the bounds property - fitInsideBounds() is only temporary and does
not set the TransformItem's bounds property. fitInsideBounds() will never
scale an object up - it will only shrink objects and/or move them.
move:Boolean (default = true) — If true (the default), the targetObject's position will change if necessary in order to fit within the bounds.
|
|
updateFirst:Boolean (default = true) — If true (the default), update() will be called first before applying the bounds. This will ensure that any changes that were made manually to the targetObject are taken into account and that the targetObject's size/position/rotation/proportions are calibrated.
|
|
customBounds:Rectangle (default = null) — Normally, fitInsideBounds() uses the TargetItem's bounds property, but if you'd like it to use a custom Rectangle instead, define it here. Use null in order to apply the TransformItem's normal bounds that were likely set through its TransformManager.
|
| move | () | method |
public function move($x:Number, $y:Number, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):voidMoves 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 item along the x-axis (can be negative or positive)
|
|
$y:Number — Number of pixels to move the item along the y-axis (can be negative or positive)
|
|
$checkBounds:Boolean (default = true) — If false, bounds will be ignored
|
|
$dispatchEvent:Boolean (default = true) — If false, no MOVE events will be dispatched
|
| rotate | () | method |
public function rotate($angle:Number, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):void
Rotates the item by a particular angle (in Radians). This is NOT an absolute value, so if one
of the item's 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 item's current rotation
|
|
$checkBounds:Boolean (default = true) — If false, bounds will be ignored
|
|
$dispatchEvent:Boolean (default = true) — If false, no ROTATE events will be dispatched
|
| scale | () | method |
public function scale($sx:Number, $sy:Number, $angle:Number = 0, $checkBounds:Boolean = true, $dispatchEvent:Boolean = true):voidScales the item along the x- and y-axis using multipliers. Keep in mind that these are not absolute values, so if the item's scaleX is 2 and you scale(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)
|
|
$angle:Number (default = 0) — Angle at which the item should be scaled (in Radians)
|
|
$checkBounds:Boolean (default = true) — If false, bounds will be ignored
|
|
$dispatchEvent:Boolean (default = true) — If false, no SCALE event will be dispatched
|
| setScaleConstraints | () | method |
public function setScaleConstraints($minScaleX:Number, $maxScaleX:Number, $minScaleY:Number, $maxScaleY:Number):voidSets minimum scaleX, maximum scaleX, minimum scaleY, and maximum scaleY
Parameters$minScaleX:Number — Minimum scaleX
|
|
$maxScaleX:Number — Maximum scaleX
|
|
$minScaleY:Number — Minimum scaleY
|
|
$maxScaleY:Number — Maximum scaleY
|