Reputation: 35
I have a text field that is centered and i pass it a sentence with the current loading status of a game, but i want to show that the screen is not frozen by putting 3 dots at the end of the current sentence that cycles from 1 to 3. When i do this the sentence moves every time i add a dot or remove a dot. How do i get a centered sentence to hold still when adding and removing information?
it does this: loading screen 1... loading screen 1.. instead of: loading screen 1... loading screen 1..
Upvotes: 0
Views: 315
Reputation: 1806
Depends if you have the textfield on the stage in Flash or if you add it programmatically.
If it's on stage you just set the text to be left aligned and center the textfield, that should be it. Set the text to "Loading screen" by default and thenn just add the dots - textfield will stay on the same place and the dots will be added on the right side
if you add the textfield programmatically it would be something like:
myTextField.text = "Loading screen"; // set the initial text
myTextField.x = int((width - myTextField.width) / 2); // center the textfield based on the width (which is the width of the object where the textfield is)
// add & remove the dots later
Upvotes: 1