in black and white
Main menu
Share a book About us Home
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

Flash MX action script bible - Reinhardt R.

Reinhardt R. Flash MX action script bible - Wiley & sons , 2004. - 987 p.
ISBN: 0-7645-4354-7
Download (direct link): macractionscriptbiblefeb2004.pdf
Previous << 1 .. 186 187 188 189 190 191 < 192 > 193 194 195 196 197 198 .. 427 >> Next

7. Go back to the stage and duplicate the mcHeroChip_1 i nstance. In the Property inspector, rename the new instance to mcHeroChip_2. Change the Advanced color mode settings for this chip so that they’re different from the previous one. Test your movie again, and notice that each chip’s color is passed to the mcHero object when the chip is clicked.
You can now implement the same strategy with other aspects of Flash interface design. For example, you can use the same methodology to create “skins” for your Flash movie. Skins are color schemes and motifs for user interface elements, such as windows, menus, and background color.
You can see the completed movie, heroColorMenu_adv.fla, in the ch16 folder of this book's CD-ROM. In this document, you will see a reset button that uses a separate object named oResetColor (in frame 1 of the actions layer) to reset the mcHero and mcBodySuit objects to their original colors.
We'd like to know what you thought about this chapter. Visit www.flashsupport .com/feedback to fill out an online form with your comments.
♦ The constructor for Color objects uses the new operator. Each instance of a Color object should be constructed in the following syntax: var objectName:Color = new Color(movieClipTarget);.
♦ All methods of the Color object are used with a specific instance, as in cHero.getRGB();. You cannot invoke methods through the class name itself, as in
0 |
-84 ]|
-33 ]|
1 y
394 Part V ♦ The Movie Classes
♦ The setRGB() and getRGB() methods of the Color class work with color values just like the Tint mode in the Property inspector.
♦ The setTransform() and getTransform() methods of the Color class work with color values, just like the Advanced mode of the Property inspector.
The TextField and Selection Classes
Text is an indispensable part of most any Flash application. In this chapter, you get a chance to look at the many facets of working with text within Flash. You’ll read about how to create text that can be controlled with ActionScript and how to actually use the ActionScript to effect changes. You can render HTML, scroll text, embed fonts, and much more.
Closely related to text is the Selection class. You can use the Selection class to get and set focus. The active object on the stage, the one receiving the user’s mouse and keystroke interaction, has focus. And you can also use the Selection class to get and set the selection within a TextField. That means that you can set an insert point for input text and you can retrieve the text that the user highlights. Read on in this chapter to learn about these things and more.
Understanding Types of Text
In Flash you can work with three types of text: static, dynamic, and input. Prior to learning ActionScript you have likely used static text almost exclusively. However, although static text has its place, it is not something that you will work with when managing text in ActionScript. Static text is not scriptable or controllable in the same ways as dynamic or input text. So let’s take a closer look at the two types of text that you will be working with via ActionScript.
Dynamic Text
Dynamic text is the basic type of text that you can manage with ActionScript. With dynamic text you can display, scroll, format, resize, and even create text completely with code. That is something that you’ll be sure to want to do as you start developing more Flash applications that contain greater amounts of dynamic content. For example, if you want to display updated news or features, you’ll want to use dynamic text. Any text that you want to update while the application is running, whether that update occurs based on loaded data, user interaction, or any other reason, should be dynamic text.
♦ ♦ ♦ ♦ In This Chapter
Learning about types of text
Creating text at authoring time and creating programmatic text at runtime
Working with TextField objects via ActionScript
Using HTML with TextField objects
Scrolling text
Getting and setting focus
Using the Selection class with TextField objects ♦♦♦♦
Part V ♦ The Movie Classes
Input Text
Input text enables a user to provide textual interaction. Input text actually includes all the same functionality as dynamic text, but it also provides the additional functionality of allowing the user to enter text values. Input text fields allow users the opportunity to do everything from entering their username and password to inputting shipping information for an e-commerce application.
Creating TextField Objects
When you create a dynamic or input text field you are actually creating a TextField object. This is important because dynamic and input text fields are instances of the TextField class, which means that you can utilize all the built-in properties and methods of the TextField class in order to control the instances with ActionScript code.
Obviously, before you can do anything with a TextField i nstance you first need to create it. In the following sections you’ll get a chance to see the various ways that you can create TextField objects. Essentially, you can categorize these ways as either authoring-time creation or runtime creation. Whether you create a TextField object at authoring time or at runtime, the object is still a TextField object that can be managed in the same way as any other TextField object. So the main consideration should be simply which technique is most appropriate given the scenario. Let’s take a closer look.
Previous << 1 .. 186 187 188 189 190 191 < 192 > 193 194 195 196 197 198 .. 427 >> Next