Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CASE STUDY: PART 1 > Using CSS in the project

Using CSS in the project

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.

  1. 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.

  2. Add the following type style to the Style container:

    <mx:Style>
         ComboBox
         {
              selectionColor: #32CD32;
         }
    </mx:Style>

  3. 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.

  4. 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>


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint