Actionscript 3 组合框';使用As3 air应用程序的ipad(视网膜显示器)的s下拉位置
我在as3移动应用程序中为ipad视网膜显示创建的应用程序。屏幕上显示的组合框的大小非常小,这是因为它动态地改变了组合框的字体和大小。这一切几乎都很好。但下拉列表定位所面临的问题是,无法改变y位置Actionscript 3 组合框';使用As3 air应用程序的ipad(视网膜显示器)的s下拉位置,actionscript-3,combobox,retina-display,Actionscript 3,Combobox,Retina Display,我在as3移动应用程序中为ipad视网膜显示创建的应用程序。屏幕上显示的组合框的大小非常小,这是因为它动态地改变了组合框的字体和大小。这一切几乎都很好。但下拉列表定位所面临的问题是,无法改变y位置 var tf:TextFormat = new TextFormat(); tf.font = "Arial"; tf.size = 35; tf.color = 0x747070; var dp:DataProvide
var tf:TextFormat = new TextFormat();
tf.font = "Arial";
tf.size = 35;
tf.color = 0x747070;
var dp:DataProvider = new DataProvider();
dp.addItem({label:"London", data:"item1"});
dp.addItem({label:"Paris", data:"item2"});
dp.addItem({label:"Sofia", data:"item3"});
dp.addItem({label:"Praha", data:"item4"});
dp.addItem({label:"Praha1", data:"item5"});
dp.addItem({label:"Praha2", data:"item6"});
_clip = new ComboBoxClip();
_clip.combo.dataProvider = dp;
_clip.combo.width = 199;
_clip.combo.height = 50;
_clip.combo.textField.setStyle("embedFonts", true);
_clip.combo.textField.setStyle("textFormat", tf);
_clip.combo.textField.setStyle("textPadding", 5);
_clip.combo.dropdown.setStyle("cellRenderer", CustomCellRenderer);
_clip.combo.dropdown.rowHeight = 31;
_clip.combo.dropdown.setStyle("paddingTop", 150);
_clip.combo.addEventListener(Event.CHANGE, onComboChange);
_clip.combo.tabIndex = 1;
_clip.x = _clip.y = 30;
addChild(_clip);
以及CustomeCellRenderer类
public class CustomCellRenderer extends CellRenderer {
public function CustomCellRenderer() {
super();
var tf:TextFormat = new TextFormat();
tf.font = "Arial";
tf.size = 35;
tf.color = 0x747070;
setStyle("embedFonts", true);
setStyle("textFormat", tf);
}
override protected function drawLayout():void {
super.drawLayout()
textField.y += 2;
textField.x += 4;
}
}
更改组合框和下拉列表的高度、宽度和文本大小以满足您的需要
var dp:DataProvider = new DataProvider();
dp.addItem({label:"London", data:"item1"});
dp.addItem({label:"Paris", data:"item2"});
dp.addItem({label:"Sofia", data:"item3"});
dp.addItem({label:"Praha", data:"item4"});
dp.addItem({label:"Praha1", data:"item5"});
dp.addItem({label:"Praha2", data:"item6"});
var tf:TextFormat;
tf = new TextFormat("Arial", 22, 0x747070);
comboBox.textField.height = 22;
comboBox.textField.setStyle("textFormat", tf);
comboBox.dropdown.setRendererStyle("textFormat", tf);
comboBox.dropdown.rowHeight = 32; //height of dropdown row
comboBox.dropdownWidth = 199; //combox and dropdown same width
comboBox.width = 199; //combox and dropdown same width
comboBox.height = 36;
comboBox.move(100, 100); //(x,y) use this to position comboBox
comboBox.prompt = "Select Something"; //if you need a prompt
comboBox.selectedItem = comboBox.getItemAt(-1); //show prompt
comboBox.dataProvider = dp;
comboBox.addEventListener(Event.CHANGE, onComboChange);
addChild(comboBox);
组合框的代码在哪里?您必须为下拉选择中的项目设置格式