The centerTextMC symbol, located in the centerText layer of Scene 1 of HUDKit.fla, is an animated textField used to display information to the user in the center of the screen. In this demo, centerText is used to display a simple tutorial at the start of every round and to announce that the user player recently was killed. After the text is displayed it will fade-out.
Figure 11: centerTextMC Symbol
centerTextMC contains the centerText MovieClip which contains the actual textField, textField. The MovieClips are arranged this way to allow for animation. centerTextMC’s timeline contains two labeled Keyframes, “on5”, which displays text for 5 seconds before playing a fade-out animation, and “on” which displays text for 3 seconds before playing a fade-out animation. The end of the timeline restarts the MovieClip’s playback at Frame 1, where the centerTextMC’s alpha is 0, hiding it until “on” or “on5” is called again.
TextFieldMC.SetText(RespawnText); // Set the text field of the Center Text. CenterTextMC.GotoAndPlay("on"); // Play the fade-in animation, it will fade on its own after ~3 sec.
Here the centerTextMC’s textField is set appropriately and the MovieClip is displayed using GotoAndPlay(“on”) The MovieClip will fade-out on its own after ~3 seconds because of the timeline’s Classic Tween.