Detailed instructions for use are in the User's Guide.
[. . . ] Using Components
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Encoder, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] An article on advanced skinning can be found online in the Macromedia Developer Center at www. macromedia. com/devnet/mx/flash/articles/skinning_2004. html.
About skinning components
97
To edit component skins in a document:
1. 2.
If you already applied the Sample theme to a document, skip to step 5. Select File > Import > Open External Library, and select the SampleTheme. fla file. For the exact location on your operating system, see "About themes" on page 108.
3.
In the theme's Library panel, select Flash UI Components 2/Themes/MMDefault and drag the Assets folder of any components in your document to the library for your document. For example, drag the RadioButton Assets folder to the ThemeApply. fla library. If you dragged individual component Assets folders to the library, make sure the Assets symbol for each component is set to Export in First Frame. For example, the Assets folder for the RadioButton component is called RadioButton Assets; it has a symbol called RadioButtonAssets, which contains all of the individual asset symbols. If you set Export in First Frame on the RadioButtonAssets symbol, all individual asset symbols will also export in the first frame.
4.
5.
Double-click any skin symbol you want to modify to open it in symbol-editing mode. You may need to select View > Zoom In to increase the magnification. When you edit a skin, you must maintain the registration point in order for the skin to be displayed correctly. 8.
When you finish editing the skin symbol, click the Back button at the left side of the information bar at the top of the Stage to return to document-editing mode. Repeat steps 5-7 until you've edited all the skins you want to change.
The live preview of the components on the Stage will not reflect the edited skins.
N OT E
9.
Select Control > Test Movie. In this example, make sure you have a RadioButton instance on the Stage and set its enabled property to false in the Actions panel in order to see the new disabled RadioButton appearance.
98
Customizing Components
Creating new component skins
If you want to use a particular skin for one instance of a component, but another skin for another instance of the component, you must open a theme FLA file and create a new skin symbol. Components are designed to make it easy to use different skins for different instances.
To create a new skin:
1. 3.
Select File > Open and open the theme FLA file that you want to use as a template. Select File > Save As and select a unique name, such as MyTheme. fla. Select the skins that you want to edit (in this example, RadioTrueUp). The skins are located in the Themes/MMDefault/Component Assets folder (in this example, Themes/MMDefault/RadioButton Assets/States).
4. 5.
Select Duplicate from the Library options menu (or by right-clicking the symbol), and give the symbol a unique name, such as MyRadioTrueUp. Click Advanced in the Symbol Properties dialog box, and select Export for ActionScript. A linkage identifier that matches the symbol name is entered automatically. Double-click the new skin in the library to open it in symbol-editing mode. [. . . ] The Iterator. next() method returns an Object, so you must define the type of your collection item, as shown in this example:
while (itr. hasNext()) { var button:ButtonC = ButtonC(itr. next()); . . . }
Access collection item properties, as appropriate for your application, as shown in this example:
item. label = button. ButtonLabel;
if (button. ButtonLink != undefined) { item. data = button. ButtonLink; } else { item. enabled = false; }
192
Collection Properties
Accessing collection items at runtime in a Flash application
If a Flash application uses a component that has a collection property, you can access the collection property at runtime. This example adds several items to a collection property using the Values dialog box and displays them at runtime using the Collection and Iterator APIs.
To access collection items at runtime:
1.
Open the MyShelf. fla file that you created earlier. This example builds on the MyShelf component and CompactDisc collection.
2.
Open the Library panel, drag the component onto the Stage, and give it an instance name. [. . . ]