I’m used to item renderers in Flex but inexperienced with Flash AS3 components.
I want to create a List that renderers items like this:
- a slider
- a couple of text fields that my designer can place and style as he likes
It’s a survey form. I expect to grab the _listData.owner and dispatch the user inputs and bubble them up to the form.
So I:
- drag a list onto the stage
- create a symbol in the library with the base class of com.blah.skins.renderers.SurveyItemRenderer
- Export this class as SurveyItemRenderer
- set the list’s cellRenderer style to SurveyItem renderer
- give the list data to show
I tried using CellRenderer, but the class seems to reject being associated with a symbol (and I could not find any examples of CellRenderer being used that way), so SurveyItemRenderer implements ICellRenderer.
When I run it, other library symbols and graphics shows up in the renderer–WITH THE EXCEPTION of the slider. Other Flash components that I put on the stage do not show up either, until you roll over (Button), or if they have text in the them (Label). Slider never shows up.
Components will show up on the stage, just not in the SurveyItemRenderer. WHY NOT? I feel like I’m missing something basic. Here is the class, minimal because I’m still testing:
public class SurveyItemRenderer extends MovieClip implements ICellRenderer
{
protected var _listData:ListData;
protected var _data:Object;
protected var _selected:Boolean;
public function SurveyItemRenderer()
{
}
override public function set data(value:Object):void
{
_data=value;
}
public function setSize(width:Number, height:Number):void
{
}
public function get data():Object
{
return _data;
}
public function set listData(value:ListData):void
{
_listData = value;
}
public function get listData():ListData
{
return _listData;
}
public function set selected(value:Boolean):void
{
_selected = value;
}
public function get selected():Boolean
{
return _selected;
}
public function setMouseState(state:String):void
{
}
}