flex项目总结

一、flex端session超时检测

this.systemManager.addEventListener(FlexEvent.IDLE, userIdle);

private function userIdle(e:FlexEvent):void {
if(e.currentTarget.mx_internal::idleCounter == 6000){//十分钟没有操作就自动跳到登陆页面
logout();
}
}


二、datagrid潜入checkbox使用

private var selecetedIndex:Array = [];//设置选中行

/*选中行*/
public function clickColum(e:Event):void{
chooseSelected();
}

private function chooseSelected():void{
this.userEquipData.selectedItem.flag = !this.userEquipData.selectedItem.flag;
for(var i:int = 0;i<userEquiplist.length;i++){
if(userEquiplist[i].flag == true){
selecetedIndex.push(i);
}
}
userEquipData.selectedIndices = selecetedIndex;
}
/*选中行绑定选中行的flag*/
public function clickCheckbox(event:Event,obj:Object):void {
//调整按钮选择性
this.unAll.selected = false;
this.all.selected = false;
//在单向绑定时可采用此法将选中信息反应到数据源
obj.flag = CheckBox(event.target).selected;

chooseSelected();
}
/*
*实现所有项目的全选中过程
*/
public function all_click(event:Event):void{
userEquiplist = this.userEquipData.dataProvider as ArrayCollection;
this.unAll.selected = false;
for(var i:int = 0 ;i<userEquiplist.length;i++){
userEquiplist[i].flag = CheckBox(event.target).selected;
if(userEquiplist[i].flag == true){
selecetedIndex.push(i);
}
}
userEquipData.selectedIndices = selecetedIndex;
}
/*
*实现项目反相选中
*/
public function unAll_click(event:Event):void{
if(CheckBox(event.target).selected){
this.all.selected = false;
userEquiplist = this.userEquipData.dataProvider as ArrayCollection;
for(var i:int = 0 ;i<userEquiplist.length;i++){
userEquiplist[i].flag = !userEquiplist[i].flag;
if(userEquiplist[i].flag == true){
selecetedIndex.push(i);
}
}
userEquipData.selectedIndices = selecetedIndex;
}
}

/*下发用例到UE*/
private function downSelectedUE(isDO:int):void{
var ac:ArrayCollection = this.userEquipData.dataProvider as ArrayCollection;
var selectedNames:String = "选中项目名称为:";
var selectedUeIds:String = "";

for(var i:int = 0;i<ac.length;i++){
if(ac[i].flag == true){
selectedNames += ac[i].ueId + "设备号码" + ac[i].ueNo;
selectedUeIds += ac[i].ueId + ",";
}
}
if(selectedUeIds.split(",").length < 2){
Alert.show("请选择要下发的UE");
return;
}
userCaseAction.downUserCase(ucId,selectedUeIds,isDO);
}


flex界面

<mx:DataGridColumn headerText="选择" textAlign="center">
<mx:itemRenderer>
<mx:Component >
<mx:HBox horizontalAlign="center">
<mx:CheckBox selected="{data.flag}" click="outerDocument.clickCheckbox(event,data)" width="13"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>


三、flex使用全局变量

/*跟踪用例*/
public function followUserCase(obj:Object):void{
Application.application.userCaseId = obj.ucId;
Application.application.moduleLoad.unloadModule();
Application.application.moduleLoad.url = 'module/caseresult/caseresult.swf';
Application.application.moduleLoad.loadModule();
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值