Share this Page URL
Help

Hour 24. Drawing with ActionScript > Creating Text - Pg. 269

Drawing with ActionScript 6. 269 There also needs to be regular calls to moveSnowflakes. This will be done by a small movie clip. Create a shape and convert it to a movie clip. Move it off the stage. Then attach this script to it: onClipEvent(enterFrame) { _root.moveSnowflakes(); } 7. 8. The snowflakes will be white. So if you leave the background color of your movie white, you won't be able to see them. Choose Modify, Document and change the color to black or a dark blue. Try your movie or the example movie 24snowflakes.fla. You can also play with the number of snowflakes and the range of values used to make each snowflake. Figure 24.7 shows one possible view of this movie as it runs. Figure 24.7. Fifty dynamically created snowflakes, all a little different from each other. Creating Text You can also create text fields from scratch using ActionScript. To do this, the primary command is createTextField, but you usually need to do much more to get the text field to look like you want. The most basic example is to create a simple field and place some text in it. Here is how it looks: createTextField("myTextField",0,0,0,200,40); myTextField.text = "Hello World."; As you can see, createTextField has many parameters. The first is the name of the text field. The second is its level. The third and fourth parameters are the x and y location of the upper-left corner of the field. The last two parameters are the width and height of a field.