Flex中通过RadioButton进行切换示例代码

随心笔谈9个月前更新 admin
207 00
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

文章摘要

这篇文章介绍了如何使用Flex组件库中的`mx.collections.ArrayCollection`来创建和管理数据集合。文章详细解释了如何在Flex场景中动态地创建和使用`ArrayCollection`对象,以及如何通过点击事件处理函数(`clickHandler`)来调整UI组件的布局。通过示例代码展示了如何在不同条件下(如选择“column”或“line”图表)调整`column`和`line`的高度,从而实现灵活的数据可视化。文章的核心内容是通过Flex组件和事件驱动的方式实现动态数据展示功能。

xmlns:s=”library://ns.adobe.com/flex/spark”

xmlns:mx=”library://ns.adobe.com/flex/mx”

width=”100%” height=”100%”>

import mx.collections.ArrayCollection;

[Bindable]

private var chartArray:ArrayCollection=new ArrayCollection([

{week:”星期一”,apple:”451245″,orange:”894544″,peach:”451245″},

{week:”星期二”,apple:”985444″,orange:”745445″,peach:”989565″},

{week:”星期三”,apple:”124544″,orange:”323565″,peach:”323121″},

{week:”星期四”,apple:”895645″,orange:”201212″,peach:”542121″},

{week:”星期五”,apple:”325645″,orange:”564545″,peach:”656454″},

{week:”星期六”,apple:”564512″,orange:”784545″,peach:”845455″},

{week:”星期日”,apple:”784545″,orange:”656232″,peach:”124545″}

]);

protected function clickHandler(event:Event):void

{

if(radio_column.enabled)

{

column.height=450;

line.height=0;

}

else if(radio_line.enabled)

{

column.height=0;

line.height=450;

}

}

]]>

paddingTop=”10″>

paddingTop=”10″>

© 版权声明

相关文章