ActionScript Warning #3551

AS3

Error:

3551

By Curtis J. Morley

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

Curtis J Morley

Description: Description of ActionScript Warning #3551 and how to work around it.

By: CurtisJMorley Rating:  Rated 1 Stars Views: 36
Embed

Add Your Comment:

User Login
User Name:

Password:

Remember me


Forgot password
Sign up
What knowledge will you share? Start Your Own Lesson