Flex控制多个button点击后的效果

 

核心:

 

 

internal function moduleCreate():void
{
	this["btnGrxx"].selected = true;
	btnSelected = this["btnGrxx"];
}

protected function totalClick(btnId:String, vsId1:String, vsId2:String, index:int, e:Event):void
{
	if(btnSelected)
		btnSelected.selected = false;
	btnSelected = this[btnId];

	
}

 

在页面.mxml中加入

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalGap="0" horizontalGap="0"
	xmlns:flexmdi="flexmdi.containers.*" 
	xmlns:flexmdiCtrl="flexmdi.controls.*" 
	xmlns:flexlib="flexlib.controls.*" 
	width="100%" height="100%"  
	backgroundImage="image/background.png" backgroundSize="100%" backgroundColor="#0975D1"
	paddingBottom="0" paddingLeft="0" paddingRight="5" paddingTop="0"
	initialize="onInitialize(event)" creationComplete="moduleCreate()">
	
	<mx:Style source="assets/css/index.css" />
	<mx:Script source="ExamManage/ExamAS.as" />

......
					<!--导航-->
					<mx:HRule strokeWidth="1"  width="100%" strokeColor="#AFC6E3" height="1"/>
					<mx:HBox id="topBar" height="45" width="100%" paddingLeft="10" verticalAlign="middle" horizontalGap="5"
					 backgroundColor="#dff6fe">
						<mx:Button id="btnGrxx" label="排名" toggle="true"
						   height="35" click="totalClick('btnGrxx', 'subvslist_1', 'subvslist_2', 0, event)"/>
						<mx:Button id="btnZbqk" label="指标1" toggle="true" 
						   height="35" click="totalClick('btnZbqk', 'subvslist_1', 'subvslist_2', 1, event)"/>
						<mx:Button id="btnGzzb" label="指标2" toggle="true" 
						   height="35" click="totalClick('btnGzzb', 'subvslist_1', 'subvslist_2', 2, event)"/>
						<mx:Button id="btnGzl"  label="指标3" toggle="true" 
						   height="35" click="totalClick('btnGzl', 'subvslist_1', 'subvslist_2', 3, event)"/>
						<mx:Button id="btnLsgz" label="指标4" toggle="true" 
						   height="35" click="totalClick('btnLsgz', 'subvslist_1', 'subvslist_2', 4, event)"/>
					</mx:HBox>
					<mx:HRule strokeWidth="1"  width="100%" strokeColor="#AFC6E3" height="1"/>
......

其中样式为:

Button {
	highlightAlphas: 0.28, 0.53;
	fillAlphas: 1, 1, 1, 1;
	fillColors: #E0F3FA, #B5DFFC, #FCF285, #F0C142;
	color: #00449d;
	textRollOverColor: #000000;
	borderColor: #95C5E0;
	fontWeight: normal;
	selectedDownSkin: Embed(source="assets/img/Button/ButBag.png");
	selectedOverSkin: Embed(source="assets/img/Button/ButBag.png");
	selectedUpSkin: Embed(source="assets/img/Button/ButBag.png");
	downSkin: Embed(source="assets/img/Button/ButBag.png");
}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值