01.07.08
Flex / Flash CS3 Warning# 3551
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
LiraNuna said,
September 10, 2008 at 7:32 pm
funny why they didn’t make the += operator use appendText…
mtmecax said,
February 15, 2009 at 8:58 am
why dodn’t work “+” as good as appendText?