To apply text formatting and style at runtime, you can use the TextFormat and TextField.StyleSheet objects.
TextFormat
TextField.StyleSheet