# Vertically centering dynamic text

**URL:** <https://forum.kirupa.com/t/vertically-centering-dynamic-text/273122>\
**Category:** flash\
**Created:** [October 11, 2008, 5:27pm UTC](https://forum.kirupa.com/t/vertically-centering-dynamic-text/273122 "2008-10-11T17:27:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthphunk](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@darthphunk](https://forum.kirupa.com/u/darthphunk)\
**Post date:** [October 11, 2008, 5:27pm UTC](https://forum.kirupa.com/t/vertically-centering-dynamic-text/273122/1 "2008-10-11T17:27:58Z")

</div>

Hey there!

I have a dynamic text field that is pulling random quotes from a text field. They are populating over a graphic of a customized playing card. Everything works fine, and the text horizontally centers fine… but it vertically centers to the top of the text box I have drawn.

Is there a way to make the textvertically align in the center? I am just learning actionscript… or re-learing it rather.

Here is the code I am using for the random text:

```auto

ranQuote = new LoadVars();
ranQuote.onLoad = function(success) {

if (success) {

RanNum = Math.ceil(Math.random()*24);
ran = this["quote"+RanNum];
quote_txt.text = ran;

}
else {

quote_txt.text = "The text failed to load due to an error";

}

}
ranQuote.load("questions.txt");

```

What is the code to align the text vertically? Also, would I put the code in the code above or would I put it elsewhere? Where would I put it?

Thanks!
