Using Flash 5's Stock Smart Clips
- The Basic Smart Clips
- RadioButton Smart Clip
- CheckBox Smart Clip
- Menu Smart Clip
- Summary
What is a smart clip? A smart clip is just a special movie clip built into Flash that's been designed so that you can pass information (parameters) into it to customize it.
All the ActionScripting is already done for you; you just toss in some values, shake it up, and out pops a customized movie clip. In other words, smart clips enable you to build, reuse, and share movie clips.
The beauty of smart clips is that you can build complex logic into a smart clip and then never have to go back in and touch the ActionScript again. In fact, if you're using a smart clip created by someone else, you don't ever have to think about the ActionScript at all.
For what would you use a smart clip? Start by looking at the smart clips that come pre-installed with Flash 5: RadioButton, CheckBox, and Menu. Radio buttons, check boxes, and drop-down menus are items that are frequently used in HTML but are actually complex to implement in Flash. Because these have been precoded as smart clips, however, you can use them in any of your projects without ever having to worry about the code behind them.
In this chapter, you learn how to do the following:
Use smart clips. Using a smart clip is as simple as dropping it onto the Stage and using the Clip Parameters panel to feed it information. You learn how to use the basic smart clips.
Get information in and out of smart clips. One of the most frequently asked questions about using smart clips is how to extract information from them. It's a surprisingly simple process.
Customize smart clips. You can customize the graphics in a smart clip to give it a different look for each project on which you work. You also can get under the hood and tweak the code to meet your needs.
After you create a smart clip, you can share it with the rest of the Flash community by posting it to the Macromedia Exchange at http://exchange.macromedia.com. In fact, before you start any project, you ought to check the Flash Exchange for any smart clips that you might be able to use. Why reinvent the wheel? Speed up your development time by developing smart!
The Basic Smart Clips
Radio buttons, check boxes, and drop-down menus are familiar interface elements to anyone who has ever spent time on the Internet. You probably just take them for granted because they are so easy to implement using HTML and JavaScript. Creating those same elements in Flash, however, is a bit more involved. Fortunately, Macromedia has taken care of this problem for you by prepackaging these same elements as smart clips in Flash.
Smart clips are preprogrammed to accept specific parameters or values. By changing the values of the parameters that are passed into a smart clip, you can customize its appearance or functionality. (See Figure 20.1.)
Figure 20.1 Smart clips are generic movie clips that are created in Flash and that you can customize for use in any project.
When you want to use one of these smart clips in a project, all you have to do is the following:
Open the Smart Clips Library (Window > Common Libraries > Smart Clips) and drag the smart clip you want to use onto the Stage.
-
Select the smart clip and select Window > Panels > Clip Parameters (or right-click or Control-click and select Clip Parameters from the pop-up menu) to open the Clip Parameters panel.
Change a value in the Clip Parameters panel by double-clicking the default parameter value and entering your own value.
That's really all there is to itdrag and drop and change a few values.
The three smart clips that come with Flash 5 look like their HTML form counterparts. In the following sections, you learn how to incorporate these basic clips into your Flash projects.