开发者

1195: Attempted access of inaccessible method defaultTextFormat

开发者 https://www.devze.com 2023-04-02 11:31 出处:网络
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 wh

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

精彩评论

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