|
Flash CS4 Resources |
Use the TileList componentThe TileList component consists of a list that is made up of rows and columns that are supplied with data by a data provider. An item refers to a unit of data that is stored in a cell in the TileList. An item, which originates in the data provider, typically has a label property and a source property. The label property identifies the content to display in a cell and the source provides a value for it. You can create an Array instance or retrieve one from a server. The TileList component has methods that proxy to its data provider, for example, the addItem() and removeItem() methods. If no external data provider is provided to the list, these methods create a data provider instance automatically, which is exposed through List.dataProvider . User interaction with the TileList componentA TileList renders each cell using a Sprite that implements the ICellRenderer interface. You can specify this renderer with the TileList cellRenderer property. The TileList component’s default CellRenderer is the ImageCell, which displays an image (class, bitmap, instance, or URL), and an optional label. The label is a single line that always aligns to the bottom of the cell. You can scroll a TileList in only one direction. When a TileList instance has focus, you can also use the following keys to access the items within it:
When you add the TileList component to an application, you can make it accessible to a screen reader by adding the following lines of ActionScript code:. import fl.accessibility.TileListAccImpl; TileListAccImpl.enableAccessibility(); You enable accessibility for a component only once, regardless of how many instances the component has. For more information, see Chapter 18, “Creating Accessible Content,” in Using Flash . TileList component parametersYou can set the following authoring parameters in the Property inspector or in the Component inspector for each TileList component instance: allowMultipleSelection , columnCount , columnWidth , dataProvider , direction , horizontalScrollLineSize , horizontalScrollPageSize , labels , rowCount , rowHeight , ScrollPolicy, verticalScrollLineSize, and verticalScrollPageSize . Each of these parameters has a corresponding ActionScript property of the same name. For information on using the dataProvider parameter, see Use the dataProvider parameter. You can write ActionScript to set additional options for TileList instances using its methods, properties, and events. For more information, see the TileList class in the ActionScript 3.0 Language and Components Reference . Create an application with the TileList componentThis example uses MovieClips to fill a TileList with an array of paint colors.
Create a TileList component using ActionScriptThis example dynamically creates a TileList instance and adds instances of the ColorPicker, ComboBox, NumericStepper, and CheckBox components to it. It creates an Array that contains labels and the names of the component to display and assigns the Array ( dp ) to the TileList’s dataProvider property. It uses the columnWidth and rowHeight properties and the setSize() method to lay out the TileList, the move() method to position it on the Stage, and the contentPadding style to put space between the TileList instance’s borders and its content, and the sortItemsOn() method to sort the content by its labels.
|