Why Use Components?


Components make it easy for you to rapidly create proof-of concepts or prototypes for larger Rich Internet Application (RIA) frameworks, to share your work with other Flash developers who work in your production team, or to share your innovations with other developers in the Flash community.

While this chapter focuses on the components bundled with the release of Flash 8, the way in which these components are used will also help you understand how other components work — from Macromedia or a third-party. Components you download sometimes come in sets, which may include many similar small applications. You may need the Macromedia Extension Manager to install them into Flash 8.

Cross-Reference 

For more information on exchanging and downloading components, please see the section "Exchanging and acquiring components" at the end of this chapter.

One of the arguments against using components is the file size they add to your productions. Even though this may be the case, there are several reasons to use components apart from the ease of dragging them to your Stage and modifying the parameters.

Caution 

Many of the V2 components in Flash 8 are substantially large in file size. For example, including a Button component adds 22 KB to the Flash movie file (.swf) size. Adding a List component contributes 47 KB to the Flash movie size. However, adding both List and Button components to your movie only puts 47 KB into your Flash movie size, not 69 KB. Why is this the case? Because the List component uses the Button component class, the Button component is already included in the class packages exported to the Flash movie. Flash intelligently only includes class files once — not multiple times.

First of all, usability is an integral part of effective interface design. Components are an extremely effective way of ensuring that your end-user understands how to use certain elements of your Flash movie. A predictable interface does not have to be boring or cliché. Furthermore, because components can be skinned, they can have a unique look from one site to the next. The components shipped with Flash 8, for the most part, are also reliable, given they were built, developed, and tested by professionals. This is not to say that the same level of construction cannot be achieved by thousands of others, but the time and effort spent in complicated coding and testing has already been done for you. And because components are a quick solution to common interface requirements, you will have more time to spend on more complicated and interesting creative tasks instead of repetitive authoring.

Caution 

Exercise care with third-party components — even those that you can download from the Macromedia Exchange. Not all components have been thoroughly tested, and some are specifically developed for one particular use in mind. Be sure to test your implementation of a component throughout the development process.

Compiled Clips: A Specific Component Format

A component is made up of one or more internal assets. One of the changes introduced with Flash MX 2004's component architecture (and continued in Flash 8), though, is that components can be compiled. This means that when you add a component to the Flash document and open your Library panel, you'll only see one symbol for the component (see Figure 33-1). In Flash MX, the same component may have added many folders and symbols that are used by the component (see Figure 33-2).

image from book
Figure 33-1: The ComboBox component in Flash 8

image from book
Figure 33-2: The Flash MX ComboBox component

The symbol type for prepackaged components is called compiled clip. There are a couple of major differences with this component format and architecture:

  • You can no longer edit the symbols of a component that has been compiled. As such, you need to use ActionScript code to change the appearance of a component. You can also overwrite the linked symbols embedded with a compiled clip with your own new linked assets.

  • Developers can now create and distribute components without the user being able to see the code used to create the component. This is a big "win" for developers who are concerned about their intellectual property rights.

If you were familiar with components in Flash MX, we highlight other differences between V1 and V2 components throughout this chapter.




Macromedia Flash 8 Bible
Macromedia Flash8 Bible
ISBN: 0471746762
EAN: 2147483647
Year: 2006
Pages: 395

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net