Jump to content
Search Community

Transforming Dynamic Text Fields

BernalCarlos test
Moderator Tag

Recommended Posts



I'm trying to transform a text input field that should resize the text font size when scaling the transform item, and that should resize itself when the user writes text in it.


To resize the text field i set the "autoSize" property to true, and to increase the font size i wrapped the text field with a movieclip and then add that to the TransformManager.


Here is my code:


//create the font format
var font: Font = new FuturaStdBold();

_textFormat = new TextFormat();
_textFormat.size = 18;
_textFormat.align = "center";
_textFormat.font = font.fontName;

//Create the text field
_textField = new TextField();
_textField.width = 200;
_textField.height = 40;
_textField.x = 100;
_textField.y = 100;
_textField.type = "input";
_textField.multiline = true;
_textField.embedFonts = true;

_textField.autoSize = TextFieldAutoSize.CENTER;

_textField.defaultTextFormat = _textFormat;
_textField.text = "Ingresa tu texto aquí...";
_textField.addEventListener(Event.CHANGE, keyStroked, false, 0, true);[/font]

[font=arial, helvetica, sans-serif]//[/font][font=arial, helvetica, sans-serif]_mcConte is the wrapper for the text field[/font]
[font=arial, helvetica, sans-serif]_mcConte.addChild(_textField);

//add the item to the stage

//add the item to the transformManager
_transItem = _transManager.addItem(_mcConte);
_transItem.hasSelectableText = true;[/font]


The resize of the text field works fine, however the scaling does not.


When i try to scale the item and it has some rotation, the text field gets out of the transformManager Box, but if i set "hasSelectableText" to false, then the scaling works but i cant input text.


Any help would be greatly appreciated.


I attached some screenshots of the problem.



Link to comment
Share on other sites

Unfortunately the autoSize functionality is creating conflicts. It's a little bit like trying to grab something and every time you move it, it jumps to a different size/position inside your hand. I don't see a way that TransformManager could support TextFields that are shifting their size/position like that. I wish I had better news for you.

Link to comment
Share on other sites

In the following link you can find a simple .fla that reproduces the problem.


[link removed because it contains TransformManager, a $299 product]


Hope it can be of help.



Oops, that was stupid lol.


here is the .fla without the TransformManager:



Edited by GreenSock
Link to comment
Share on other sites

Aha! I see what the problem is and I just uploaded an update to TransformManager that should resolve that issue. It had to do with non-TextFields needing to be unrotated first before applying the width/height values and then rotated back internally. Please log into your GreenSock account and download the latest version. https://www.greensock.com/account/


Sorry about any confusion there, and thank you for putting together a simple example FLA. That was very helpful indeed.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...