ActionScript Warning: 3551: Appending text to a TextField using += is many times slower than using the TextField.appendText() method.
ActionScript Error Description:
I love this ActionScript Warning. This is not technically an ActionScript Error instead it is a warning that helps you code better. It is very clear and easily deciphered. This states that you should not use the old way to add text to a text field but rather use the new TextField.appendText() method. This improves performance dramatically and will prevent the user from getting the 15 sec. timeout. (Error #1502: A script has executed for longer than the default timeout period of 15 seconds.)
Fix:
Use TextField.appendText() instead of +=.
Bad Code:
var something:String = “Happy “;
var somethingElse:String = “Birthday”;
myTF_txt.text = something;
myTF_txt.text += somethingElse;
Good Code:
var something:String = “Happy “;
var somethingElse:String = “Birthday”;
myTF_txt.text = something;
myTF_txt.appendText(somethingElse);
ActionScript Warning #3551 is simple and easy (the way that all ActionScript errors/ warnings should be)
As always – Happy Flashing
why dodn’t work “+” as good as appendText?
funny why they didn’t make the += operator use appendText…