Skip to main content
Participant
January 20, 2012
Question

Problem with an editable TLFTextField with a right align

  • January 20, 2012
  • 2 replies
  • 1747 views

Hi,

I've been checking out the TLF for a project in hebrew and it has great features but I have a small but very annoying problem :

When I create (even in the Flash IDE) an editable TLFTextField and I set the align to right (or center), the clickable area to set the focus on this text is not where it should be : it's on the right of the textfield.

Has anyone ever had this problem ?

Is there a known solution to get rid of this problem ?

Here's a simple example so you can reproduce the issue.

In this case, if you click on the left part of the textfield, it does not get the focus. If you drag your mouse to the right part of the textfield, the mouse cursor changes and if you click the field gets the focus. The clickable area also extends to the right of the textfield.

package  {

    import flash.display.MovieClip;

    import fl.text.TLFTextField;

    import flashx.textLayout.formats.TextLayoutFormat;

    import flashx.textLayout.elements.TextFlow;

    import flash.text.TextFieldType;

    import flashx.textLayout.formats.TextAlign

    import flash.text.TextFormat;

    import flash.text.TextFormatAlign;

    public class Main extends MovieClip {

        public function Main() {

            var myTLFTextField:TLFTextField = new TLFTextField();

            addChild(myTLFTextField);

            myTLFTextField.x = 10;

            myTLFTextField.y = 10;

            myTLFTextField.width = 500;

            myTLFTextField.height = 70;

            myTLFTextField.type = TextFieldType.INPUT;

            myTLFTextField.border = true;

            var myFormat:TextLayoutFormat = new TextLayoutFormat();

            myFormat.textIndent = 8;

            myFormat.color = 0x336633;

            myFormat.fontFamily = "Arial, Helvetica, _sans";

            myFormat.fontSize = 50;

            myFormat.textAlign = TextAlign.CENTER;

            var myTextFlow:TextFlow = myTLFTextField.textFlow;

            myTextFlow.hostFormat = myFormat;

            myTextFlow.flowComposer.updateAllControllers();

        }

    }

}

Note : The problem occurs only if the height of the textfield is bigger than the font size : if you change the height of the textfield to 50, then it works as it should; The thing is I need a multiline textfield...

Thanks a lot for your help.

This topic has been closed for replies.

2 replies

Participant
January 23, 2012

More info :

I just found out that it works perfectly well if I compile this exact same code with Flash CS5.

However, if I use Flash CS5.5, the problem is there...

Adobe Employee
January 29, 2012

Flash pro implemented TLFTextField based on TLF. In CS5.5, its implementation changed.

However, in CS5.0 and CS5.5, TLF library remains the same, which is TLF 2.0.

Please forward the question to http://forums.adobe.com/community/flash/flash_general.

Participant
January 20, 2012

I've found people who have the same problem but no valid answers :

http://stackoverflow.com/questions/7250671/tlf-text-field-align-right-problem

or

http://forums.adobe.com/message/3893357/

Thanks for any help you could give