flex学习-----控件与菜单
一、状态按钮
ToggleButtonBar
清除按键的选中状态:public function clearSelected():void{
if(selectedIndex != -1){
var btn:Button = getChildAt(selectedIndex) as Button;
btn.selected = false;
this.dataReset = false;
}
}
二、色板
ColorPicker
得到选中色板的颜色值:在change事件中调用:private function setColor(evt:ColorPickerEvent):void{
cnv.setStyle("backgroundColor",evt.color);
}
三、用SWFLoader载入swf文件
source="assets/Sub1.swf"/>
四、设置控件在页面中的索引
(将索引(tabIndex)设置为1)
五、利用控件的labelFunction来设置控件的显示内容
private function getFullName(item:Object):String{
return item.fName + " " + item.lName;//(item为每一项的数据源值)
}
六、菜单
MenuBar
Source">
Source1" type="separator"/>
Source2" type="separator"/>
Source3" type="separator"/>
public function memuClick(event:MenuEvent){
Alert.show(event.item.@label + "被选中!");
}
七:日期控件
(日期文本框)
(日期选择器)
八:弹出窗口
PopUpManager
//弹出
public function testPop(){
p2 = new part2_titlewindow();
p2.message = "dddddd";
PopUpManager.addPopUp(p2,this,true);
PopUpManager.centerPopUp(p2);
}
//关闭
public function outPot(){
PopUpManager.removePopUp(p2);
}
九:自定义的弹出按钮边框
1》自定义类:CustomPanelSkin
复写方法:override protected function updateDisplayList(w:Number,h:Number):void {
super.updateDisplayList(w,h);
var gfx:Graphics = this.graphics;
gfx.beginFill(this.getStyle("borderColor"),this.ge tStyle("borderAlpha"));
gfx.moveTo(this.getStyle("cornerRadius"),0);
gfx.lineTo(15,-10);
gfx.lineTo(25,0);
}
2》设置边框皮肤
十:focusIn与focusOut等事件
与click等事件一样,添加监听器,定义事件发生的所有执行的方法即可。
十一:
猜你喜欢
转载自idnyg86v.iteye.com/blog/1572790
今日推荐
周排行