# Custom align in TextField?

**URL:** <https://forum.kirupa.com/t/custom-align-in-textfield/328197>\
**Category:** flash\
**Created:** [April 26, 2012, 9:34am UTC](https://forum.kirupa.com/t/custom-align-in-textfield/328197 "2012-04-26T09:34:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![panoss](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@panoss](https://forum.kirupa.com/u/panoss)\
**Post date:** [April 26, 2012, 9:34am UTC](https://forum.kirupa.com/t/custom-align-in-textfield/328197/1 "2012-04-26T09:34:58Z")

</div>

I want to make a custom alignment method for a TextField (of ‘input’ type).  
The reason for this?  
Let’s say I have a Text Field with 4 lines of text.  
I want the first 2 to be ‘centered’, and the other 2 to stay unformated, no align.  
With the standard way:  
my\_format.align=‘center’;  
my\_text\_field.setTextFormat(my\_format);  
…the alignment gets aplied to the **whole** text (AND the 4 lines).  
If I replace the scond line with: my\_text\_field.setTextFormat(selectionStart, selectionEnd, my\_format); no alignmentis applied.

So I must make a custom align method, a snippet. How should start?
