Custom CellRenderer?
I have attempted to implement a custom cellrenderer for my list component in AS3 in Flash CS3.
Here is what I have in the FLA.
import flash.display.MovieClip;
import fl.controls.List;
stop();
var cr:customRenderer = new customRenderer();
lstTest.setStyle("cellRenderer", cr);
lstTest.addItem({label:"Jeff"});
lstTest.addItem({label:"Ben"})
Where lstTest if the instance of the list component on the stage.
Here is my customRenderer class;
package
{
import fl.controls.listClasses.CellRenderer;
import flash.text.TextFormat;
public class customRenderer extends CellRenderer
{
public function customRenderer()
{
var newFormat:TextFormat = new TextFormat("Arial", 12, 0x00FF00);
setStyle("textFormat", newFormat);
}
}
}
When the custom renderer is applied to the list component the only cell that is rendered witht he new new font and color is the last one added to the component. The other one doesn't show up at all. If I click on the cell showing I get and error from the list component.
Can anyone see what I am doing wrong with this custom cellrenderer?