Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Several utility functions are needed in this game to create text fields and buttons. These cut down the amount of code needed quite a bit. We don’t have to repeat the same new TextField, addChild, and x and y settings every time we create a text field.
What createText does is take a series of parameters and make a new TextField. It sets the x, y, width, and TextFormat values to the values passed in as parameters. It also sets some constant parameters, such as multiline and wordWrap, which will be the same for everything created in the game.