Flex表单中回车下移焦点的方法
对于习惯了使用桌面应用程序的用户而言,回车后下移焦点到下一个编辑组件中的小功能,是非常贴心的,利用flex中的KEY_DOWN事件可以方便的实现回车下移焦点,代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="CreationComplete()" height="398" width="518" backgroundColor="#E6E3E3">
<mx:Script>
<!--[CDATA[
import mx.containers.HBox;
import mx.core.UIComponent;
import mx.events.CloseEvent;
import mx.controls.Alert;
public function CreationComplete():void{
var monthNames:Array=new Array;
var dayNames:Array=new Array;
monthNames.push("一","二","三","四","五","六","七","八","九","十","十一","十二");
dayNames.push("日","一","二","三","四","五","六");
this.edtccrq.monthNames = monthNames;//中文月份名
this.edtgrrq.monthNames = monthNames;
this.edtrzrq.monthNames = monthNames;
this.edtccrq.dayNames = dayNames;//中文星期名
this.edtgrrq.dayNames = dayNames;
this.edtrzrq.dayNames = dayNames;
this.edtccrq.formatString = "YYYY-MM-DD";//本地日期格式
this.edtgrrq.formatString = "YYYY-MM-DD";;
this.edtrzrq.formatString = "YYYY-MM-DD";
//以下批量添加事件监视
var childs:Array= this.mainvbox.getChildren();
//取出顶级对象的子组件集合
var item:Object;
for each (item in childs){
if (item is HBox){
var items:Array = (item as HBox).getChildren();
//取出HBox中的子组合集合
var subitem:Object;
for each (subitem in items){
if (subitem is UIComponent) {
(subitem as UIComponent).addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown);
//给组件注册KEY_DOWN事件。
}
}
}
}
}
private function btncloseclick():void{
this.parentApplication.panelassetedit.visible=false;
this.paren
相关文档:
通过Flex中的Timer可是实现数字时钟的效果,其效果图如下:
实现的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<!--[CDATA[
import mx.formatters.DateFormatt ......
Mxml组件的打开和关闭特效
openDuration="1000" openEasingFunction="Bounce.easeOut"
closeDuration="1000" closeEasingFunction="Bounce.easeIn"
//菜单透明效果
background-color:#000000;
background-alpha:0.1;
border-style:solid;
drop-shadow-color:#000000;
drop-shadow-enabled:yes;
//展开所 ......
No.1 某字符器放到粘贴版:
System.setClipboard(strContent);
No.2 复制数组:
//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.addItem( i );
}
// fantastic ! //
var bar:ListCollectionView = new ListCollectionVi ......
前期准备:
点击File菜单 -> New -> MXML Component,然后弹出一个对话框。
在对话框中输入组件名,选择此组件继承的类型,如:Canvas,DataGrid,ComboBox …… 等。
然后选择组件的大小,点击Finish即可。
关于组件继承的类型,假设Based on  ......