开发者

1195: Attempted access of inaccessible method defaultTextFormat

I'm following a tutorial on creating text fields and I don't know why m开发者_StackOverflow社区y code does not work.. I've googled around and it seems the problem is with something being private while overriding some classes. I'm not doing any of the complex stuff, just creating a text field and formatting it.

var newTextField:TextField = new TextField();
var newTextFormat:TextFormat = new TextFormat();
newTextFormat.size = 24;
newTextField.defaultTextFormat(newTextFormat); //<-- ERROR
object.addChild(newTextField);

where object is just a movieclip. The code is inside a function.


defaultTextFormat is not a function it is setter getter.

var newTextField:TextField = new TextField();
var newTextFormat:TextFormat = new TextFormat();
newTextFormat.size = 24;

newTextField.defaultTextFormat = newTextFormat; //<-- NO ERROR

object.addChild(newTextField);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜