Using styles with the List

You can set style properties to change the appearance of a List component. The styles specify values for the component's skins and padding when the component is drawn.

The various skin styles allow you to specify different classes to use for the skin. For more information on using the skin styles, see About Skins.

The following procedure sets the value of the contentPadding style for the List component. Notice that the value of this setting is subtracted from the size of the List to achieve the padding around the content, so you might need to increase the size of the List to prevent text in the List from being cropped.

To set the contentPadding style for the List:

  1. Create a new Flash file (ActionScript 3.0) document.
  2. Drag the List component from the Components panel to the Stage and give it an instance name of aList.
  3. Select Frame 1 in the main Timeline, open the Actions panel, and enter the following code, which sets the contentPadding style and adds data to the List:
    aList.setStyle("contentPadding", 5);
    aList.setSize(145, 200);
    aList.addItem({label:"1956 Chevy (Cherry Red)", data:35000});
    aList.addItem({label:"1966 Mustang (Classic)", data:27000});
    aList.addItem({label:"1976 Volvo (Xcllnt Cond)", data:17000});
    aList.rowCount = aList.length;
    
  4. Select Control > Test Movie.