MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 155

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Description
Method; takes the values given and creates a representation of them in the cell. This resolves any
difference between what was displayed in the cell and what needs to be displayed in the cell for
the new item. (Remember that any cell could display many values during its time in the list.) This
is the most important CellRenderer method, and you must implement it in every cell renderer.
The
method is called frequently (for example, when a rollover, a selection, column
setValue()
resizing, or scrolling occurs). Therefore, you should write
that allow code to run only if a change has occurred. See the "Example" section
setValue()
below.
If a row is selected and the mouse pointer is over it, the value of the selected parameter is
, not
"highlighted"
renderer behave differently according to whether the row is in a selected state. To test whether the
current row is in a selected state, use the following code:
var reallySelected:Boolean = selected ne "normal" && listOwner.selectedNode ==
item;
Example
The following example shows how to use
renderer instance in a grid.
Because a particular cell might not exist on the Stage (for example, if it's scrolled out of the display
area) or because it might be reused to render another value, you cannot directly reference a
specific cell renderer instance in the grid.
Instead, use the data provider to communicate with a specific cell in the grid. The data provider
holds all the state information about the grid. To display a given cell as enabled or selected
(checked), there should be a corresponding field in the data provider to hold that information.
The
method of your cell renderer communicates changes in the data provider's state
setValue()
to the cell. The following is a
renders a check box in the cells:
function setValue(str, itm, sel)
{
/* Assume the data provider has two relevant fields for this cell : checked and
enabled.
The form of such a data provider might look like this:
[
{field1:"DisplayMe", field2:"SomeString", checked:true, enabled:false}
{field1:"DisplayMe", field2:"SomeString", checked:false, enabled:true}
{field1:"DisplayMe", field2:"SomeString", checked:true, enabled:true}
]
*/
// redundancy checking
if (myCheck.selected!=itm.checked){
myCheck.selected = itm.checked;
}
. This can cause problems if you're trying to make the cell
"selected"
setValue()
setValue()
statements in the body of
if
and
editField()
implementation from a theoretical cell renderer that
to reference a cell
CellRenderer API
155

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

This manual is also suitable for:

Flash mx

Table of Contents