i'm trying to use ComboBox with a list of checkboxes. It's working fine, but i can't start the list with all checkboxes selected. i thought i could add items with the dataProvider "additem" method, and define selected:true, but it's not working. Is it possible to start this CheckBox list in a ComboBox with all checkbox selected?
Something like this:
package eines
{
import flash.display.MovieClip;
import fl.controls.ComboBox;
import fl.data.DataProvider;
import flash.text.TextFormat;
import eines.CustomCellRenderer;
public class CheckComboBox extends MovieClip
{
public var myCB:ComboBox = new ComboBox();
public var myDP:DataProvider = new DataProvider();
public function CheckComboBox(dades:Array, missatge:String, amplada:Number, font_name:String = "Calibri", font_size:Number = 10)
{
var myformat:TextFormat = new TextFormat();
myformat.font = font_name;
myformat.size = font_size;
for(var i:int = 0; i<dades.length; i++)
{
myDP.addItem({label:dades[i], ***selected:true***, data:i});
}
myCB.dataProvider = myDP;
myCB.prompt = missatge;
myCB.width = amplada;
myCB.dropdown.setStyle("cellRenderer", CustomCellRenderer);
myCB.textField.setStyle("textFormat", myformat);
myCB.dropdown.setRendererStyle("textFormat", myformat);
addChild(myCB);
}
}
}
Aucun commentaire:
Enregistrer un commentaire