Reputation: 1330
I create a spark.components.Label, and I want to change the text alignment. The api states it has a property textAlign, but I get this error. What am I doing wrong?
import spark.components.Label;
var mylabel:Label = new Label();
mylabel.textAlign = "right";
Error: Access of possibly undefined property textAlign through a reference with static type spark.components:Label.
Upvotes: 0
Views: 1804
Reputation: 11912
The API states that Label has a style called textAlign
, not a property.
If you wish to assign a style through ActionScript, you can do so like this:
myLabel.setStyle('textAlign', 'right');
Upvotes: 7