daiikota
daiikota

Reputation: 133

Vertical align text As3 Label Coponent

I have a simple question, is it possible to vertical align the text that is displayed by the Label component in Flash CS6.

Upvotes: 0

Views: 891

Answers (1)

adaam
adaam

Reputation: 3706

Only the TLFTextField (class in the package fl.text) has a built-in property to set the text vertical alignment.

Go to this page for more information

Unfortunately in AS3 labels are very limited in what they can do - you could use the setStyle property of the Label to reference a predefined TextFormat but still TextFormat lacks any appropriate public properties that are relevant to your question.

So I advise you just to use a textfield as a replacement for the label's text option which you can easily manipulate programatically like so:

    var label1:TextField = new TextField();
                label1.y = 100; // any value here for vertical text alignment
                label1.width = 100; // any height
                label1.height = 100; // any height
                label1.text = "label 1 text"; // label text here
                addChild(label1); // adds it to the stage

EDIT: added addChild - totally forgot!

Here is a simple tutorial about AS3 textfields

Upvotes: 1

Related Questions