|
|
|
Components free you from concern with how you are
going to implement the advanced functionality for a project.
Furthermore, using
While we will be looking at how to
create
components later, in Chapters 10 and 11, the
majority of this book is about how to
use
components. We go step-by-step through the process of using many
different types of components. Whether you are a beginner or an
advanced Flash
In the
|
|
|
|
|
|
Macromedia has
The best way of overcoming these minor
hurdles is to simply start working with components. In this
chapter, you will work with a relatively simple component that
utilizes the default component
Most of this book's components use custom user interfaces. However, components available for free frequently utilize the default UI. In addition to learning the basics of components, working with the default UI will help you appreciate the value of good custom UIs.
The default component UI
Understanding parameter types and value types
Experimenting with values
|
|
|
|
|
|
Fundamentally, a component allows you to manipulate variables within ActionScript without having to delve into the actual ActionScript. For instance, let's say you had some ActionScript that utilizes Flash MX's ability to draw a rectangle with code. Even something as simple as a rectangle has several potential
All of these variables can be "hard-coded" within the ActionScript, meaning that the variables are part of the code. The problem with this is that if you want to change these variables, you must go into the code. Finding and editing the code required to generate a rectangle would not be particularly hard. However,
Figure 2.1:
The
Chapter2_A_Modified.fla
sample file is
Furthermore, the code might not all be in one place. For complex resources, finding and editing the variables can be difficult and
In components, each variable is called a
parameter
. Components make it easier to customize or change the parameters by placing them in a more accessible location: the Component Parameters panel. As you will see in the following example, the Component Parameters panel can take on a wide range of different
| On the CD |
Open Chapter2_A_Start.fla in the Chapter 2 folder on this book's CD. Save the file to your local hard drive as Chapter2_A_Modified.fla . |
In this Flash file, the stage is peppered with components. Actually, there are only two components, but there are multiple instances of each of the two components. An instance refers to a particular copy of a symbol in Flash. For example, if you create a movie clip and then drag three copies of that movie clip onto the stage in Flash, you have three instances of that movie clip.
You can manipulate components in much the same way you can manipulate any other symbol in Flash. You can generate multiple instances of a component, and you can duplicate and/or copy a component. If you use multiple instances of a component, you gain the same file-
Go ahead and test the movie to observe what it does (see Figure 2.2). What you will see is a rich animation. If you look
Figure 2.2:
Multiple copies of two components are used in this example to generate a rich, textured, animated background.
|
|
|