Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We will add a couple of simple CSS tags to control the color of the selections in the ComboBox as well as the color of all the text in the application.
Right under the Application tag in BooksMain.mxml, enter a Style tag as follows:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"layout="absolute" backgroundColor="#FFFFFF"xmlns:comp="components.*" height="100%" width="100%"> <mx:Style> </mx:Style> <mx:Image source="assets/Logo1.gif" x="360" y="10"/>
Assume that you want the selection in the ComboBox control to be lime-green.
Add the following type style to the Style container:
<mx:Style>
ComboBox
{
selectionColor: #32CD32;
}
</mx:Style>Save and test the application. Switch to the Our Books page and click a selection in the ComboBox control. It should come up as the color you set.
What about if you want to change the color of all the text to dark blue? You can define a global style to set the color. Add the following to the Style container:
<mx:Style>
ComboBox
{
selectionColor: #32CD32;
}
global
{
color:#00008B;
}
</mx:Style>