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);
精彩评论