Error #1168: Illegal assignment to function setTextFormat.
This is another easy one. It just means that you assign the format within parenthesis rather than after the “=” sign.
Bad Code:
var myText:TextField = new TextField();
var myFrmt:TextFormat = new TextFormat();
myFrmt.color = 0x336699;
myFrmt.font = “Franklin Gothic Book”;
myText.text = “Flash is fun – Happy Flashing Everyone”;
myText.border =true;
myText.wordWrap = true;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.setTextFormat = myFrmt;
this.addChild(myText);
Good Code:
var myText:TextField = new TextField();
var myFrmt:TextFormat = new TextFormat();
myFrmt.color = 0x336699;
myFrmt.font = “Franklin Gothic Book”;
myText.text = “Flash is fun – Happy Flashing Everyone”;
myText.border =true;
myText.wordWrap = true;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.setTextFormat(myFrmt);
this.addChild(myText);
And this is how you resolve Error #1168: Illegal assignment to function setTextFormat.
Pingback: Action Script Error Repository » 1168 Illegal assignment to function