The Power of Components

Probably the quickest and easiest way to understand what components are and why they are valuable is to compare them with a product you already know. In many ways, Flash components are similar to plug-ins for programs such as Adobe Photoshop or Discreet 3ds max. Components also have similarities to macros used by popular word processors like Microsoft Word. But to call components "plug-ins" or "macros" would be a disservice. They are much more powerful than that, as suggested by Figure 1.1.

click to expand
Figure 1.1: Would it be immodest of me to tell you that I was the model for this illustration?

Components are resources that have the Flash programming (ActionScript) encapsulated with any other required resources (graphics, text, audio, etc.). If you can use ActionScript to program something in Flash, you can turn that something into a component.

Components are particularly useful for automating any kind of repetitive or complex task that requires ActionScript. While we'll be looking at the value of components more from a user's perspective in this book, let's look at an example on the programming side to illustrate the usefulness of components.

Let's say you need a bunch of slick drop-down menus for a variety of Flash interfaces. You are a very good ActionScript programmer and can easily program the drop-down menu. Once you program the drop-down menu, you have useful code that you can use again and again.

While most programmers are in the practice of using their code repeatedly, it still takes a lot of time for even the quickest and most incredibly talented programmers to make modifications to their code. Often programmers only need to modify variables in their code. However, those variables might be buried in hundreds of lines of code, or the programmer might need to modify multiple references to the variables or to modify a large array of variables.

In fact, it's not uncommon for programmers to spend more time modifying their existing code than they did when they originally programmed the code. If a programmer comes back to their code six months after they originally coded it, they might easily forget a variable reference or something else important that could lead to hours and hours of bug hunting.

This often leads programmers to simply recode the item. Whether you're a programmer or not, you can probably appreciate the fact that it is very inefficient to continually recode something from scratch.

Components help you avoid such a fate. Developers can create components so that the variables for the code can be more easily modified through a much more accessible interface. This, in turn, allows programmers and nonprogrammers alike to leverage that code repeatedly without tediously rooting through the actual code to make modifications.

As mentioned earlier, if you can generate something with Flash and ActionScript, then you can make a component out of it. You can make components generate any sort of effect that can be created using Flash and ActionScript, including dynamic menus, programmatic animation effects, and audio or video controls. You can even use components to generate entire games.

Your Flash projects can even contain multiple components. You could, for example, create a Flash site that contains a component that generates the navigation system along with a component that controls what audio is playing in the background.

If you are relatively new to Flash, components let you add advanced functionality into your projects without requiring that you learn programming. If you are an advanced Flash designer or programmer, components save you time by automating repetitive tasks. You can then put that time towards making your projects all the more compelling.

Components do not increase the download time of a Flash movie. Flash components are made from the same resources you would use if you didn't use a component. A drop-down menu made with a component usually uses the same resources as a drop-down menu created without a component. The only difference is that the component is easier to use and modify.

On the CD 

This book is about showing you how to leverage the incredible value of components. In the following chapters, you will learn how to use, manage, and even create components. The book's companion CD gives you all of the components featured in this book as well as many additional sample components.

When you are finished with this book, you will be able to "save the world before bedtime" and leap tall deadlines with a single bound. You'll feel compelled to think of a cool super hero name for yourself, and you'll soon be making sketches for your new costume, all the while wondering how good you'll look in spandex and tights.

Well okay, you may not find yourself hiding your secret identity with a pair of cheap glasses while fighting off a sudden crush for anyone named Lana Lang, but learning to utilize components will certainly empower you to do more things in much less time with Flash.

The Hidden Power of Flash Components
The Hidden Power of Flash Components
ISBN: 0782142109
EAN: 2147483647
Year: 2002
Pages: 111 © 2008-2017.
If you may any questions please contact us: