Formating Text

I am trying to format text using a function thats within a class. For some reason the only way I can format it is by using an onEnterFrame function otherwise it wont work. Does anyone know why?

    public function MainFormant():Void
    {
        message_text.SettxtWidth(Stage.width);
        message_text.SetAlignment(2);
        message_text.SetFontSize(50);
        message_text.SetFontColor(StyleSheet.HOME);

    }