Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 15.1. Applying Individual Component Styles

Problem

You want to change the styles for a single component instance.

Solution

Call the setStyle( ) method for the component instance.

Discussion

Each of the UI components (combo box, checkbox, list, text input, and so on) has an ActionScript method named setStyle( ). Using setStyle( ), you can programmatically tell Flash to change many aspects of the component's appearance. There are many styles that you can change using the setStyle( ) method, as discussed in the recipes throughout this chapter. However, regardless of which style you want to change, the same basic syntax applies:

	componentInstancename.setStyle(stylename (exp 3pod.com), styleValue);

One of the styles that can be applied to all of the UI components is a style called themeColor. There are three preset values for themeColor (haloGreen, haloBlue, and haloOrange), as you can read in Recipe 15.5. The following code shows how you can apply a new themeColor value to a button component instance named cbtSubmit:

	cbtSubmit.setStyle("themeColor", "haloOrange");
 


If you want to apply just one or two styles to a single component instance, the setStyle( ) technique described in this recipe will be ideal. However, if you want to apply many styles to the instance, or if you want to apply the same styles to more than one component instance, consider the other techniques that are discussed in detail in the following three recipes.

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations