Retaining Alignment + textFormat

Hi,

I have a movie where the user is able to type text into an input text field. The textfield itself is set to be left-aligned, but I provide the users with 2 buttons for alignment… left-align and center-align buttons. I have it so that if they click on one of the buttons, it sets a variable that stores the alignment with the one desired, and then calls a function that contains all of the textFormat code to display the text with this latest change. That works fine, to an extent…

When the movie is first started, the text is left aligned (as it shoudl be since the text field is set that way)… and then if I type in some text and then hit the ‘center’ button, it centers it like it should. Now here is where the problem is: If I go to add in more text before what is already there, or select some of the text and begin typing, it immediately left-aligns the text again. It would be annoying for the user to have to hit re-center the text again…and to make things worse, I have it so that when each button is pushed, it shows an ‘on-state’ … so when it automatically left-aligns the text, the ‘center’ button is still active.

Any suggestions as to how I might solve this?

Thanks!
b.