Avg. Rating 4.0
Tags:



Problem

You need component that can simply transform UI element (change x, y, width, height, rotation)

Solution

You can use skinnable, customizable and free open source library with TransformTool.

Detailed explanation

You need to download TransformTool.swc, include it in your project path and add it on stage as in example below:

<?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 "
               xmlns:view="
com.vstyran.transform.view.* " >

    <!-- background fill -->
    <s:Rect top=" 0 " right=" 0 " left=" 0 " bottom=" 0 " >
        <s:fill>
            <s:SolidColor color=" #dddddd " />
        </s:fill>
    </s:Rect>

    <s:Image id=" image " x=" 50 " y=" 50 " width=" 160 " height=" 100 "
             minHeight="
20 " minWidth=" 32 "
             scaleMode="
stretch " source=" @Embed('image.jpg') " />

    <view:UITransformTool target=" { image } " />

</s:Application>

See a little bit more complicated example below.

You can download source clicking right mouse button on example and select view source context menu.

Also visit my blog to see a lot of examples how to create tool skins, how to use guidelines, snapping to grid and lots more...


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes