flex App小例子Combox List flex 教程 flex培训 flex源码 flex实例

来源:互联网 发布:百度建造师软件 编辑:程序博客网 时间:2024/05/22 13:39

 转:http://zhidao.baidu.com/question/114531385.html

1.ComboBox 添加数据

2.ComboBox 的label

3.list数据动态添加

<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"    xmlns:s="library://ns.adobe.com/flex/spark"    xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"><fx:Declarations><!-- 将非可视元素(例如服务、值对象)放在此处 --></fx:Declarations><!-- data model --><fx:Script><![CDATA[import mx.collections.ArrayCollection;[Bindable]private var coffeeArray:ArrayCollection = new ArrayCollection([{label:"Red Sea",data:"Smooth and fragrant"},{label:"Andes",data:"Rich and pungent"},{label:"Blue Mountain",data:"Delicate and refined"}])private var cartArray:ArrayCollection = new ArrayCollection();public function addToCart():void{cartArray.addItem(coffeeCombo.selectedItem.label);}]]></fx:Script><!-- view --><mx:Panel title="My First Flex App"><mx:Label text="Coffee Blends"/><mx:ComboBox id="coffeeCombo" dataProvider="{coffeeArray}"/><mx:Text text="Description: {coffeeCombo.selectedItem.data}"/><mx:Button label="Add to Cart" click="addToCart()"/><mx:List dataProvider="{cartArray}" /></mx:Panel></s:Application>