Free Transform Manager As3 v1.5.1

Many of you have been emailing me about supporting objects with non-top-left registration points. Here’s an update that recognizes and compensates for all registration points. Give it a try and let me know if it works. You can find the older version here.

[kml_flashembed movie=”http://ryantan.net/content/FTM/TestFTM.v1.5.2.swf” height=”600″ width=”630″ /]

Download:
v1.5.1 Source + Examples
v1.5.2 Source + Examples

Added a dragArea property in 1.5.2 that accepts a flash.geom.Rectangle that specifies the area the objects a confined to. But it has not been fully tested so please do report bugs when you are using them.

Some of you also asked about how to use FTM in flex, here’s a simple .mxml demonstration:


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="900" minHeight="600" creationComplete="init();" width="630" height="420">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[

import com.ryan.geom.FreeTransformManager;
import flash.display.Sprite;

public var fts:FreeTransformManager;
public var mySprite:Sprite = new Sprite();

public function init():void {

// Set up FreeTransformManager
fts = new FreeTransformManager(false);

mySprite.graphics.beginFill(0xEEEEEE);
mySprite.graphics.drawRect(0, 0, 90, 90);
mySprite.graphics.endFill();

// Adding to canvas doesn't work as FTM doesn't know of the .rawChildren quirk.
//theCanvas.rawChildren.addChild(mySprite);

// This worls
theUIComponent.addChild(mySprite);

fts.registerSprite(mySprite);
}
]]>
</fx:Script>

<mx:Box>
<mx:Canvas id="theCanvas" x="0" y="0" width="630" height="420" backgroundColor="#316C92">
<mx:UIComponent id="theUIComponent" left="0" top="0" bottom="0" right="0">
</mx:UIComponent>
</mx:Canvas>
</mx:Box>
</s:Application>

33 thoughts on “Free Transform Manager As3 v1.5.1

  1. Nabil

    hello
    first of all thank you for the great tool.
    i’m having trouble using it on flex 3 as it doesn’t know the “fl.motion.MatrixTransformer”, any idea about how to put it to work.
    thank again

    Reply
  2. Nabil

    Thank you so much Ryan.. it worked ^^
    i still want to ask you a question if you don’t mind :p
    is there anything to do to limit the drag area?
    Thank you again for your time and your perfect tool.

    Reply
  3. deepeyes

    Thanks you very much ryan
    i have the same question if there is any way to drag objects in limits(specific area)

    regards

    Reply
  4. ryan

    To deepeyes and Nabil, I’ve added a dragArea property in 1.5.2 that accepts a flash.geom.Rectangle that specifies the area the objects a confined to. But it has not been fully tested so please do report bugs when you are using them.

    Find links to the new source in the post itself.

    Reply
  5. George

    Hi Ryan,
    I would like to add a feature to FTS to enable users to add the handler in a custom MovieClip. In case the image is under a mask. I started adding this feature (running into issues) but I would love it if we can collaborate on this so I don’t have to update my codebase every time you make an update and possibly help with other features you have planned. Having said that, can you please push this to Github for ease of collaboration.

    Reply
  6. Arthur

    Good day to all, thank you ryan for great tool. I have one problem , if you can suggest something it will be great, i need the simple close button to all the objects under fts, I’ve tried to create close button on my movie clips but it not generating the event listeners, can you suggest something

    Reply
  7. Carlos

    Hi Ryan,

    This a really nice work. Thank you.

    I was wondering if i was able to scale the images and the text unproportionaly.

    Also, i was wondering if i could remove the one click scaling rotation.

    Reply
  8. Michael

    Wonderful library!! .. I’m wondering, does this support object snapping? So as I drag an object it will show a line to let me know I can align an object with another object.

    Reply
    1. ryan

      Thanks Michael, unfortunately the answer is no, and not for the foreseeable future. But it does make for a good thought exercise on how this feature might be implemented. Thanks for the suggestion!

      Reply
  9. Krish

    Hello Ryan, your class is very helpful to me but i am not able to rotate and scale input text box(try Embedding font also). Whenever i click on input text box its text is gone. Thanks

    Reply
  10. Pingback: Free Transform Manager As3 v1.3 | Ryan Tan

    1. Ryan Tan Post author

      Hi dekdoys, there’s no api calls to do that now, but you can edit the drawDefaulthandle() function to suit your needs. It accepts a Sprite parameter on which you can draw your custom handles.

      Reply
  11. Darcey76

    Hi,

    Great little tool 🙂

    What’s the best way to remove the resize box and handles on mouse out instead of clicking on another item which has the transform manager registered to it? I only need the resize controls to appear on mouse over. Or will I have to hack it up and make it do this myself?

    Thanks

    Darcey

    Reply
      1. Darcey76

        No worries, I jumped into the class and slapped some mouse events in there and all is working fine now. Hide on mouse out, show active on if active mouse over etc.

        Also added a [x] button for delete item 😉

        Useful little tool this 😉

        Thanks

        D

        Reply
  12. dibuix

    Hello Ryan!!
    I need to add a button to apply a mirror effect. How could I do it?
    I’ve also thought about double-click to invert (mirror) the image
    Can you help me?

    THANKS!

    Reply
  13. squall3d

    To have the sprite always snap to mouse pointer location rather than remembering the offset, Goncy Pozzo suggests, replacing all stage.mouseX by me.mouseX

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *