Using styles with the TileList

The TileList's styles specify values for its skins, padding, and text formatting when the component is drawn. The texFormat and disabledTextFormat styles govern the style of the text that displays in the component. For more information about the skin styles, see Using skins with the TileList.

The following example calls the setRendererStyle() method using the textFormat style to set the font, size, color, and text attributes of the labels that display in a TileList instance. The same process applies also to setting the disabledTextFormat style that is applied when the enabled property is set to false.

To set the textFormat style for a TileList instance:

  1. Create a new Flash file (ActionScript 3.0).
  2. Drag the TileList component to the Stage and give it an instance name of myTl.
  3. Add the following code to the Actions panel on Frame 1 of the Timeline.
    myTl.setSize(100, 100);
    myTl.addItem({label:"#1"});
    myTl.addItem({label:"#2"});
    myTl.addItem({label:"#3"});
    myTl.addItem({label:"#4"});
    var tf:TextFormat = new TextFormat();
    tf.font = "Arial";
    tf.color = 0x00FF00;
    tf.size = 16;
    tf.italic = true;
    tf.bold = true;
    tf.underline = true;
    tf.align = "center";
    myTl.setRendererStyle("textFormat", tf);