Using the Senocular AS3 TransformTool in Flex

Hey,I am so interested about that you had ever used the ‘TransformTool’ library in your Flex project. But there is little examples showing how to use it in flex, Would you please share some example about how to use ‘TransformTool’ in Flex? I have tried as such a way:

but it failed at line
canvas.addChild(defaultTool);
Can you give any hints? Thanks.

Like most pure AS3 display classes, the TransformTool needs to be added to a UIComponent wrapper to function properly in Flex.

Source.

Related posts:

  1. The Flickr AS3 API and Flex
  2. Flex component transformation with ObjectHandles
  3. Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC
  4. Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model
  5. Enumerating data types in Actionscript 3 (AS3)

  • Blaight
    It is so great. Thanks a lot.
    Expects example with detailed source code.
  • Blaight
    You are so nice. The source code is availiable now. Thank you very much.

    But I have a little problem. Do I have to add the TransformTool to the top level container such as Application in your example? Based on your example, if I use
    hbox.addChild( component);
    then something strange happends. It seems that the TransformTool is 'under' the image and can not response to moving action the rotation point can not be seen yet.
  • Joel
    I add the TransformTool to the top level container.
  • ynk
    when u rotate then scale, the scale doesnt follow properly the cursor because of the difference between mouse coordinates which are always with a 'virtual' rotation=0 and the angle of the object.

    i had the same bug while doing my class. I used this :

    var rotationRad:Number = rotation * Math.PI / 180;
    var px:Number = XY.x * Math.cos(rotationRad) - XY.y * Math.sin(rotationRad);
    var py:Number = XY.x * Math.sin(rotationRad) + XY.y * Math.cos(rotationRad);

    hope it'll work
  • I think there is one line missing in the function scaleTopRightInteraction. Add below
    _toolMatrix.ty += oldBounds.subtract(boundsBottomLeft).y;
    the line:
    _toolMatrix.tx += oldBounds.subtract(boundsBottomLeft).x;

    Otherwise, scaling of a rotated target does not work properly.

    There is also the issue with resizing the browser. The controls and the target move apart as soon as the browser window is resized.
  • rui
    I don like it, it just implements matrix, in some cases this is great, but if I'm applying to an container, I don want scale the container (just width/height), imagine that I have a frame border on that picture, then the border will stretch too.. i had senocular full implemented on adigitalbook.com, then i had to remove :(
  • @rui

    That was ultimately why I stopped using this tool and went with ObjectHandles instead.
  • kanu kukreja
    I want to add delete control on top right, i tried alot and added 2 neew classes as well "TransformToolDeleteControl.as" & "TransformToolDeleteCursor.as", but that control is not getting visible anyhow.
    And one more thing if i move rotation control in to center then it stops working.
    Can anybody please share their ideas with me.
  • Neo
    Nice example,but the transformToll can not transform the TexArea,any idea?
  • Joel
    My guess is that you need to use embedded fonts.
  • I don't think the transform tool from Senocular does resize the controls containing the text elements like textarea. It actually scales the target. I have created my own custom transform tool which works wonderfully also with rotating cursors.
blog comments powered by Disqus

every-sword
every-sword