- Scripting the Calendar
- Preparing a Custom User Interface
- Moving from Movie Clip to Smart Clip
- Setting Smart Clip Parameters
- How It Works
Preparing a Custom User Interface
A custom user interface (UI) file isn't required, but it makes it easier for others to customize instances of your Smart Clip symbol and can make the whole process just a little more attractive (see Figure 9). In addition, a custom UI is a great way to display branding and copyright notices if you plan to distribute a Smart Clip to fellow developers.
If you don't use a custom UI, Flash simply displays a standard-looking input box that looks a lot like the Generator panel. If you do use a custom UI, you can include animations and artwork and anything else that Flash can manage. In this example, the CalendarUI file is quite basicin fact, it contains only some text and three input fields!
Figure 9 A custom user interface makes the task of customizing Smart Clip instances easier.
Open the CalendarUI.fla file from source archive, save it to your hard drive, and open the XCH movie clip from its Library.
Within the CalendarUI file is a movie clip instance named XCH. This is the exchange clip, and it contains a text field for each of the three parameters that will be added to the Calendar Control Smart Clip. The process of getting the information entered into this UI to the actual calendar control itself isn't actually all that mysterious. The variables attached to each of the text fields in XCH are simply transferred inside the Calendar instance upon export. Then the functions that you inserted earlier have access to that data as if those variables had always been there.
Click each of the text fields, and then use the Text Options panel to note their variable names (see Figure 10).
Figure 10 Use the Text Options panel to take note of the variable names assigned to each text field.
Copy CalendarUI.fla to the same folder that your MegansDiary file is located in, use Export Movie to export it, and then name it Calendar.swf.
The file CalendarUI.swf is now available for use as the custom UI.