I googled this, and all of the code I came across either didn't work or seemed like a lot of code for such a simple thing. All I wanted to do was vertically center my text against a container I was displaying it in, no matter if I had 1 line, 2 lines, 3, etc.
So I came up with the following code. Just make sure that the object you want to center against is center aligned within the movieClip.
myDynamicText.autoSize = true;
textHeight = myDynamicText._height;
myDynamicText._y = -(textHeight/2);
That's it.
No comments:
Post a Comment