TransformManager (AS3) – Interactively Scale/Rotate/Move DisplayObjects
- Version: 1.881, Updated 2010-03-07
- Compatibility: Flash Player 9 and later (ActionScript 3.0)
Description
TransformManager makes it easy to add interactive scaling/rotating/moving of DisplayObjects to your Flash or Flex application. It uses an intuitive interaction style that's similar to most modern drawing applications. When the user clicks on a managed DisplayObject, a selection box will be drawn around it along with 8 handles for scaling/rotating. When the mouse is placed just outside of any of the scaling handles, the cursor will change to indicate that they're in rotation mode. Just like most other applications, the user can hold down the SHIFT key to select multiple items, to constrain scaling proportions, or to limit the rotation to 45 degree increments.
(To see a Flex Example, click here.)
Features
- Select multiple items and scale/rotate/move them all simultaneously.
- Includes a "FlexTransformManager" class that makes it simple to integrate into Flex applications.
- Perform virtually any action (transformations, selections, etc.) through code.
- Depth management which allows you to programmatically push the selected items forward or backward in the stacking order
- Optionally set minScaleX, maxScaleX, minScaleY, and maxScaleY properties on each item
- Arrow keys move the selection (optional)
- You can set the scaleMode of any TransformItem to SCALE_WIDTH_AND_HEIGHT so that the width/height properties are altered instead of scaleX/scaleY. This can be helpful for text-related components because altering the width/height changes only the container's dimensions while retaining the text's size.
- There is a 10-pixel wide draggable edge around around the border that users can drag. This is particularly helpful with TextFields/TextAreas.
- Define bounds within which the DisplayObjects must stay, and TransformManager will not let the user scale/rotate/move them beyond those bounds
- Automatically bring the selected item(s) to the front in the stacking order
- The DELETE and BACKSPACE keys can be used to delete the selected DisplayObjects
- Lock certain kinds of transformations like rotation, scale, and/or movement
- Lock the proportions of the DisplayObjects so that users cannot distort them when scaling
- Scale from the DisplayObject's center or from its corners
- Listen for Events like SCALE, MOVE, ROTATE, SELECTION_CHANGE, DEPTH_CHANGE, CLICK_OFF, FINISH_INTERACTIVE_MOVE, FINISH_INTERACTIVE_SCALE, FINISH_INTERACTIVE_ROTATE, DOUBLE_CLICK, and DESTROY
- Set the selection box line color and handle thickness
- Cursor will automatically change to indicate scale or rotation mode
- Export transformational data for each item's scale, rotation, and position as well as the TranformManager's settings in XML format so that you can easily save it to a database (or wherever). Then apply it anytime to revert objects to a particular state.
- Optionally hide the center handle
- VERY easy to use. In fact, all it takes is one line of code to get it up and running with the default settings.
Notes / Limitations
- All DisplayObjects that are managed by a particular TransformManager instance must have the same parent (you can create multiple TransformManager instances if you want).
- Objects with their scaleMode set to SCALE_WIDTH_AND_HEIGHT (like TextFields) cannot be flipped (have negative scales), nor can they be skewed. Therefore, when one is part of a multi-selection, scaling will be disabled because it could skew the object (imagine if a TextField is at a 45 degree angle, and then you selected another item and scaled vertically - your TextField would end up getting skewed).
- Due to several bugs in the Flex framework (acknowledged by Adobe), TransformManager cannot accommodate scrollbars in its container, nor can TextFields be scaled disproportionately and scaleX/scaleY/width/height properties don't always report properly after updates are made with TransformManager (again, these are bugs in the Flex framework, NOT TransformManager). However, I created a "FlexTransformManager" class that extends Canvas and makes it easy to integrate into Flex applications. Just beware that the DisplayObjects in the FlexTransformManager will be contained within the bounds of the FlexTransformManager.
- Due to a limitation in the way Flash reports bounds, items that are extremely close or exactly on top of a boundary (if you define bounds) will be moved about 0.1 pixel away from the boundary when you select them. If an item fills the width and/or height of the bounds, it will be scaled down very slightly (about 0.2 pixels total) to move it away from the bounds and allow accurate collision detection.
![]() |
As always, there's a 30-day money-back guarantee included. If you don't like the class and would prefer to forfeit your license and get a refund within 30 days, no problem.
Other links: License | Forums | AS2 version (NOT identical feature set)
Documentation
Click here for full ASDoc documentation
Important properties
- constrainScale : Boolean To constrain items to only scaling proportionally, set this to true [default:false]
- scaleFromCenter : Boolean To force all items to use the center of the selection as the origin for scaling, set this to true [default:false]
- lockScale : Boolean Prevents scaling [default:false]
- lockRotation : Boolean Prevents rotating [default:false]
- lockPosition : Boolean Prevents moving [default:false]
- arrowKeysMove : Boolean When true, the arrow keys on the keyboard move the selected items when pressed [default: false]
- autoDeselect : Boolean When the user clicks anywhere OTHER than on one of the TransformItems, all are deselected [default:true]
- allowDelete : Boolean When the user presses the delete (or backspace) key, the selected item(s) will be deleted (except TextFields) [default:false]
- allowMultiSelect : Boolean To prevent users from being able to select multiple items, set this to false [default:true]
- bounds : Rectangle Defines the boundaries for movement/scaling/rotation. [default:null]
- lineColor : Number Controls the line color of the selection box and handles [default:0x3399FF]
- handleSize : Number Controls the handle size (in pixels) [default:8]
- handleFillColor : Number Controls the fill color of the handle [default:0xFFFFFF]
- paddingForRotation : Number Sets the amount of space outside each of the four corner scale handles that will trigger rotation mode [default:12]
- enabled : Boolean Allows you to enable or disable the TransformManager [default:true]
- forceSelectionToFront : Boolean When true, new selections are forced to the front of the display list of the container DisplayObjectContainer [default:false]
- selectedTargetObjects : Array An easy way to get an Array of all selected targetObjects
- selectedItems : Array Similar to selectedTargetObjects, but returns the TransformItem instances of the selected items
- items : Array All of the TransformItem instances that are controlled by this TransformManager (regardless of whether they're selected or not)
- targetObjects : Array All of the targetObjects (DisplayObjects) that are controlled by this TransformManager (regardless of whether they're selected or not)
- hideCenterHandle: Array If true, the center scale handle will be hidden.
- ignoredObjects : Array Sometimes you want TransformManager to ignore clicks on certain DisplayObjects, like buttons, color pickers, etc. Those items should populate the ignoreObjects Array. The DisplayObject CANNOT be a child of a targetObject.
Events
- TransformEvent.SELECTION_CHANGE (the TransformEvent's "items" Array contains any items affected by the selection change - either deselected or selected. to determine which items are selected after the Event, check the TransformManager instance's selectedItems Array)
- TransformEvent.MOVE
- TransformEvent.SCALE
- TransformEvent.ROTATE
- TransformEvent.FINISH_INTERACTIVE_MOVE
- TransformEvent.FINISH_INTERACTIVE_SCALE
- TransformEvent.FINISH_INTERACTIVE_ROTATE
- TransformEvent.CLICK_OFF (only called when autoDeselect is false, otherwise the DESELECT event is called)
- TransformEvent.DELETE
- TransformEvent.DOUBLE_CLICK
- TransformEvent.DEPTH_CHANGE
- TransformEvent.DESTROY
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)
EXAMPLES
To make two MovieClips (myClip1 and myClip2) transformable using the default settings:
-
import com.greensock.transform.TransformManager;
-
var manager:TransformManager = new TransformManager({targetObjects:[myClip1, myClip2]});
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:[myClip1, myClip2], 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 myClip1 and myClip2 after a TransformManager has been created, set scale constraints so that myClip2 cannot be scaled below 0.5 or above 1, and then listen for when only myClip1 is selected:
-
import com.greensock.transform.TransformManager;
-
import com.greensock.events.TransformEvent;
-
-
var manager:TransformManager = new TransformManager();
-
-
var clip1Item:TransformItem = manager.addItem(myClip1);
-
var clip2Item:TransformItem = manager.addItem(myClip2);
-
clip2Item.setScaleConstraints(0.5, 1, 0.5, 1);
-
-
clip1Item.addEventListener(TransformEvent.SELECT, onSelectClip1);
-
-
function onSelectClip1($e:TransformEvent):void {
-
trace("selected myClip1");
-
}
Flex example
To make two Images (myImage1 and myImage2) transformable using the default settings:
-
<?xml version="1.0" encoding="utf-8"?>
-
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:transform="com.greensock.transform.*">
-
<transform:FlexTransformManager id="myManager" width="500" height="500">
-
<mx:Image source="../libs/image1.png" id="myImage1" autoLoad="true" x="100" y="100" />
-
<mx:Image source="../libs/image2.png" id="myImage2" autoLoad="true" x="0" y="300" />
-
</transform:FlexTransformManager>
-
</mx:Application>
Tip
- I want autoDeselect on, but I don't want items deselected when the user clicks on certain buttons or form elements. How can I accomplish that? You have several options. You could have TransformManager ignore particular DisplayObjects using the addIgnoredObject() method, or try this:
- Set autoDeselect to false
- Add a background Sprite (it could have a transparent fill so that it's invisible but still clickable)
- Add an Event.CLICK listener to that background Sprite that calls your TransformManage's deselectAll() function.
FAQ
- What if I want to save the state of a transformed object and then recreate (save and load) it to continue working with it? Can TransformManager accommodate that?
Absolutely, that's precisely what the exportFullXML() and applyFullXML() methods are for. You need to handle loading the images/assets on your own, but it's easy to build a dynamic application around TransformManager. In fact, a huge number of TransformManager users do exactly that. - If I purchase TransformManager, do I get access to the raw source code files or just a SWC?
You get the raw source code. Feel free to tweak it if you want, (just don't redistribute it). - What if I purchase TransformManager but don't like it? Can I get my money back?
Of course. I always offer a 30-day money-back guarantee. If you'd like to forfeit your license and get your money back, just e-mail me and I'll promptly send you the refund. - Do you offer discounted pricing for charitable/educational projects?
Yes I do, depending on the project. Feel free to contact me about your request at info@greensock.com. - What are the terms of the license? Is there a multi-user/corporate license available?
If you would like to use TransformManager in a commercial appication or on a team with multiple developers, all you need to do is get the corporate Club GreenSock membership that corresponds to the number of developers in your organization (including freelancers, consultants, etc. who may get access to the code). See the licensing page for details and answers to frequently asked questions. - Can I use TransformManager to transform dynamically-loaded assets?
Absolutely. Just load your asset, make sure it is fully instantiated, and then use the addItem() method to add it to your TransformManager instance. Keep in mind that all of a TransformManager's items must share the same parent. - Why do you charge for the code? Why not go open source like you did with TweenLite/TweenMax?
I've learned the hard way that it takes a LOT of work to create, enhance, document, distribute, and support open source code. The vast majority of visitors to my blog just take the code and run. It becomes difficult to justify all the time I invest in the open source stuff. TransformManager caters to a very specific audience, and I think that $299 is actually quite a bargain considering the fact that it represents well over $30,000 worth of development time. - Can I use TransformManager in Flex 3?
Sure! In fact, I created a FlexTransformManager class to make it particularly easy to integrate into Flex applications. Please be aware of the limitations, though (see above). Many customers are using it successfully in Flex applications. - I'm a "Shockingly Green" Club GreenSock member, so do I get a discount?
Yes you do. "Shockingly Green" Club GreenSock members get a 15% discount. If you haven't received instructions from me yet about how to receive your discount, just e-mail me and I'll send you a special link.
Need Help?
Feel free to e-mail me a question. Or post your question on the forums.
![]() |
Comments (17)

Kevin Hoyt from Adobe talks about his experience with TransformManager here:
http://blog.kevinhoyt.org/2008/08/13/greensock-transform-manager-as3/
As does Matt Przybylski:
http://evolve.reintroducing.com/2008/10/02/as3/my-as3-transformmanager-experience/
And Erik Hallander:
http://www.erikhallander.com/blog/2008/greensock-releases-transformmanager-a-spectacular-as3-class.html
Hey,
Just want to add a little support here. I think for a lot of developers your offering us a short cut for a very fair price. I haven’t bought it yet, however i make good use of your TweenLite and more recently TweenMax open source projects. Its not that we can’t write it ourselves but you’ve done an excellent job with it i on’t see why i should re invent the wheel. The above looks very powerful, when i need a decent transform suite i’l likely be back to pay for it but for now just leaving this as my thanks. Don’t want to be one of ‘those’ developers who take the code and run…. i was…. but now im not?
Kevin At Twisted
Jack,
As always I am blown away by your work.
Contributions by people like yourself to the state of this art we call ActionScripting push the boundaries of the field without a doubt.
Maximum kudos, man.
I talked my boss into buying our company a TransformManager licence, and saved many hours development time.. They plugged straight in, with 1 line of code + a few imports. And worked immediately! Awesome.
Thank you GS!
I was sceptical to spend $299 for the transform manager.. the money back guarentee from Jack was good idea.. so i went ahead and paid for it. It plugged in very well .. i am using it quite often..
Now i feel its worth every penny.
frankly there is no magic in this library, you will know that when u see the source code. but IT DOES WHAT IT CLAIMS TO DO in a simple and better way.
I would definetely return and pay Jack if he creates any other lib, that could be useful to me and my projects.
Prabhu
I recently purchased and implemented the TransformManager component I wanted to leave a quick post just to say how pleased I am with it. I know it might seem like a heavy cost outlay, especially considering the abundance of open-source code available, but it really has been value for money. I downloaded it and it just worked, that simple. Anyone “Ummming and Arrghhhing” and weather or not pay the money should know that will be well worth while.
This hearty endorsement is also due to the fact that when I ran into trouble I got a friendly and immediate help from Jack (Mr Greensocks himself) Good customer Service deserves good feedback, so here it is. 5 stars, 2 thumbs up, happy as larry, bob’s your uncle.
well, reading from the above posts, i was wondering if i could add anything… well, i just bought the transform manager a few days ago, but only today i got the chance to implement it….. simple, quick and no complications (many “big” software makers should look at Jack for inspiration)… this code is just an amazing tool which is well worth every cent. If you are in doubt… don´t be.. Jack is doing an amazing work with and for the AS community, he deserves our respect and thanks!
Just wanted to say thanks for all the time you’ve put into the TransformManager component. It has saved me a lot of time not having to implement these features myself. I use it in a t-shirt / product customization tool where text / clipart get scaled, rotated and moved. You can see this component in action at:
http://gametimesupply.com/customize/designer.aspx
The support I’ve received has been just as good. I’ve been using TransformManager for over 9 months now and there have been several occasions where I needed help with some feature or needed something added and I’ve always gotten a quick and speedy reply.
Thanks again
gs TransformManager indirectly won a favourite website award (FWA.com) with it’s use in the house of the dead poster creator: http://www.overkillpostercreator.com/
As a long time fan of TweenLite and TweenMax i didn’t hesitate when i had to decide on purchasing the TransformManager. Since i’ve done a similar solution long time ago i know how much hassle it is to create similar solution. It saved me a lot of time and gave functionality, that i wouldn’t create myself – cause of deadlines. So paying 300$ for scalable, light and easy to use solution is nothing comapring to time and effort i would have to put into development of such a solution. In other words, if you’re developing something for a company it’s always worth it, as it may give you more time for making your applications rock.
I’ve been using TweenLite and TweenMax for a while now, which was one of the main reasons why I concidered buying this library instead of developing something similar myself for a current project.
And I’ve got to say it’s worth every penny, because it saved me many hours and being able to access the source made the class very insightful.
I would like to share my experience with this great class. At first I was hesitating to purchase it at first but found out I could really use it and boy was I right!
I have been able to use it in several projects and getting it to do what I want has always been quite easy. Thanks to the great support Jack offers you won’t be stuck when you’ve got a question.
Also, the forum has a lot of questions answered that you may have
so be sure to check that out as well!
The Transformmanager also gets updates in case any bugs or problems are found!
What more can I say that hasn’t already been said? Don’t doubt! Buy
Just finished a site where we use Transformmanager, and it was a great experience. Every time i thought needed to hard code some stuff into it, i found a setting to accommodate my needs.
see the efforts here.
http://design.boconcept.com/usa
a really great tool.
No one can program this functionality as good as fast as you can buy and implement this lib. It took me less than 15 minutes to add it to my application and get all the functionality working. Considering all the time and all the effort you’d have to put in yourself, this lib is a big bang for the buck.
Really nice class. I just love it. If u had tried to create an analogue, u would know how hard it is to deal with the native Matrix class, how buggy it is.
Jack, we purchased your TransformManager AS3 classes. Why do you offer a “money-back guarantee”? – Nobody who has tried this awesome peace of software will want one – THEY ARE SOOOOOOO BRILLIANT – YOU TOO
Jack, I can’t thank you enough for this. When I first saw this I thought “yeah right, there’s no way I’m spending $300 for someone else’s code”. Then I thought about how many hours it would take me to build a version with half the features of yours, and after some simple math, I realized I’d be a fool not to buy this. I wasn’t let down. I got it up and running in less than 10 minutes and it worked flawlessly. The API is very well documented and easy to use, too. It’s been a pleasure using this tool (as well as TweenLite which I just started using too). I’ll be sure to keep tabs on you and your future products. Thanks again!








