4.
Click the Advanced button in the lower-right corner of the Create New Symbol dialog box
to enable more options.
The Advanced button is available when you are in the basic mode of the Create New
Symbol dialog box. If you don't see the Advanced button, you are probably already in the
Advanced view of the dialog box.
5.
In the Name text box, type MultiLineCell.
The default value for Type is Movie Clip. Leave Movie Clip selected.
6.
Click the Export for ActionScript check box in the Linkage section.
Enabling this option allows you to dynamically attach instances of this symbol to your
Flash documents during runtime. The Identifier text box will automatically show
MultiLineCell.
7.
Set the ActionScript 2.0 Class to MultiLineCell (to match the class name of the
MultiLineCell cell renderer class created previously).
8.
Enable the Export in first frame check box and click OK to apply your changes and close
the dialog box.
If you need to modify the MultiLineCell Movie Clip symbol's Linkage properties at a
later time, you can right click the symbol in the document's library and select
Properties or Linkage from the menu.
9.
Drag the DataGrid component from the Components panel to the library.
The DataGrid instance will be created dynamically through ActionScript in the
following step.
10.
Select the first frame on the main Timeline (make sure you are not still in the
MultiLineCell movie-clip editing mode).
11.
In the Actions panel for the first frame, enter the following code to create a DataGrid
dynamically, assign data to the DataGrid, and assign your new cell renderer class:
// Create a new DataGrid component instance
this.createClassObject(mx.controls.DataGrid, "myGrid_dg", 1);
// Build a data provider for the data grid with four columns of data.
myDP = new Array();
var aLongString:String = "An example of a cell renderer class that
displays a multiple line TextField";
myDP.addItem({firstName:"Winston", lastName:"Elstad", note:aLongString,
item:100});
myDP.addItem({firstName:"Ric", lastName:"Dietrich", note:aLongString,
item:101});
myDP.addItem({firstName:"Ewing", lastName:"Canepa", note:aLongString,
item:102});
Using the CellRenderer API
115
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers