Package
classes.quietless.tools.TransformTool
Inheritance
Sprite ••> TransformTool

This is a TransformTool similar to the one in PhotoShop, Ilustrator, Flash etc. that allows to you to rotate or scale any Display Object at runtime.

Sample Usage

package  {
	
import flash.display.MovieClip;
import flash.geom.Rectangle;

import classes.quietless.tools.TransformTool;

  public class ApplicationMain extends MovieClip
  {
    private var _transformTool;

    public function ApplicationMain ()
    {
	_transformTool = new TransformTool();            
	_transformTool.mode = TransformTool.ROTATE;
	_transformTool.iconScale = new HandleHintScale();          
	_transformTool.iconRotate = new HandleHintRotate();
	_transformTool.boundaries = new Rectangle(50, 50, 475, 260);
	addChild(_transformTool);
		
	// register targets //    
	_transformTool.targets = [sprite1, sprite2, sprite3];
	_transformTool.activeTarget = sprite2;		
    }
  }
}
View Example
View Class File
Source Files

Public Properties

Property
mode : String
sets the current mode of the TransformTool to one of two constants : TransformTool.SCALE or TransformTool.ROTATE
targets : Array
an array of sprites on the stage that can be selected by the tool.
activeTarget : DisplayObject
sets the new target for the TransformTool to affect
boundaries : Rectangle
optional boundaries to constrain where the target can be dragged
iconScale : Sprite
a library item to represent the TransformTool's scale mode handle
iconRotate : Sprite
a library item to represent the TransformTool's rotate mode handle
maxScale : Number
max scale constraint as a percentage of 1.00 - default is 1 (100%)
minScale : Number
min scale constraint as a percentage of 1.00 - default is .2 (20%)

Properties Details

private static var _mode
_mode : String

Currently there are two modes to this tool, 'scale' and 'rotate'. In a future version I will remove the need to select between them. For now you will have to create a button or some logic that toggle modes between the two modes as demonstrated in the sample files.

private static var _targets
_targets : Array

An array of display objects that can receive mouse events, e.g. Sprites & Movieclips

private static var _target
_target : DisplayObject

Sets a new target for the TransformTool to affect. This can be any custom class that extends DisplayObject

private static var _boundaries
_boundaries : Rectangle

The default value is the stageHeight and stageWidth. You can optionally constrain where the target can be dragged by setting this property at runtime.

private static var _iconScale
_iconScale : DisplayObject

This is any library item graphic that you would like to represent the scale mode icon when the target is rolled over.

private static var _iconRotate
_iconRotate : DisplayObject

This is any library item graphic that you would like to represent the rotate mode icon when the target is rolled over.

private static var _maxScale
_maxScale : Number

A number (percentage based) that the target can be scaled out to. This value must be larger than whatever you set minScale to.

private static var _minScale
_minScale : Number

A number (percentage based) that the target can be scaled down to. This value must be smaller than whatever you set maxScale to.