1、Text控件

外观:

代码:

<?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"> <fx:Script>
<![CDATA[
import mx.controls.Alert;
public function showMsg(msg:String):void
{
Alert.show(msg);
}
]]>
</fx:Script> <s:Panel title="TextSample" verticalCenter="0" horizontalCenter="0">
<s:layout>
<s:VerticalLayout/>
</s:layout> <s:Label text="TextInput" fontWeight="bold"/>
<s:TextInput id="TextInput"/> <s:Label text="TextArea" fontWeight="bold"/>
<s:TextArea id="TextArea" textAlign="center" width="100%" height="40"/> <s:Label text="RichTextEditor" fontWeight="bold" color="#ff0000"/>
<mx:RichTextEditor id="RichTextEditor" height="150" width="650"
borderSkin="mx.skins.spark.BorderSkin" borderColor="0x000fff"/> <s:Label text="RichEditableText" fontWeight="bold"/>
<s:RichEditableText textAlign="center" color="#127892" backgroundColor="0xfff000" width="100%">
<s:content>
Greetings <s:span fontWeight="bold" color="#ff0000">people</s:span> of<s:br/>
<s:span fontSize="20">EARTH!</s:span>
</s:content>
</s:RichEditableText> </s:Panel> </s:Application>

TextSample

2、Date控件

外观:

代码:

<?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">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
public function showMsg(msg:String):void
{
Alert.show(msg);
}
]]>
</fx:Script>
<s:Panel title="DateSample" verticalCenter="0" horizontalCenter="0">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Label text="DateField" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:DateField text="12/05/2008" id="thisDateField"
change="showMsg(thisDateField.selectedDate.toString())"/> <s:Label text="DateChooser" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:DateChooser id="thisDateChooser"
maxYear="2010" minYear="2006"
selectedDate="{new Date(2008,10, 15)}"
change="showMsg(thisDateChooser.selectedDate.toString())"> </mx:DateChooser>
</s:Panel>
</s:Application>

DateSample

3、Numeric控件

外观:

代码:

<?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"> <fx:Script>
<![CDATA[
import mx.controls.Alert;
public function showMsg(msg:String):void
{
Alert.show(msg);
}
]]>
</fx:Script>
<s:Panel title="NumericSample" width="360" height="240" horizontalCenter="0" verticalCenter="0">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:VGroup>
<s:Label text="NumericStepper" fontWeight="bold" backgroundColor="0xff0022"/> <s:NumericStepper id="kids"
minimum="0"
maximum="10"
stepSize="1"
change="showMsg(kids.value.toString())"/> <s:HGroup>
<s:Label text="Spinner" fontWeight="bold" backgroundColor="0xff0022"/>
<s:Spinner minimum="0" maximum="10" id="collegeKids"/>
<s:Label text="{collegeKids.value} in college"/>
</s:HGroup> <s:Label text="HSlider" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:HSlider id="commuteTimeRange" minimum="0" maximum="180"
tickInterval="15"
labels="[0 mins,180 mins]"
thumbCount="2" snapInterval="5"
change="showMsg(commuteTimeRange.values.toString())">
</mx:HSlider> </s:VGroup>
<s:VGroup>
<s:Label text="VSlider" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:VSlider id="yourHeight" minimum="0" maximum="300"
tickInterval="50" snapInterval="1"
labels="[0,50,100,150,200,250,300]"
change="showMsg(yourHeight.values.toString())"/> </s:VGroup>
</s:Panel>
</s:Application>

NumericSample

4、Button组件

外观:

代码:

<?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"> <fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection; [Bindable]
public var myArray:ArrayCollection = new ArrayCollection(['One','Two','Three']); public function showMsg(msg:String):void
{
Alert.show('You just clicked on ' + msg);
}
]]>
</fx:Script>
<s:Panel title="ButtonSample" width="360" height="240" horizontalCenter="0" verticalCenter="0">
<s:VGroup>
<s:Button id="thisBtn" label="Button" click="showMsg('button')"/> <mx:LinkButton id="thisLinkBtn" label="LinkButton"/> <s:Label text="ButtonBar" fontWeight="bold" backgroundColor="0xff0022"/>
<s:ButtonBar id="thisBtnBar" labelField="ButtonBar"
dataProvider="{myArray}"
click="showMsg(ButtonBar(event.currentTarget).selectedItem)" /> <s:Label text="LinkBar" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:LinkBar id="thisLinkBar"
dataProvider="{myArray}"
itemClick="showMsg(event.label)" /> <s:Label text="ToggleButtonBar" fontWeight="bold" backgroundColor="0xff0022"/>
<mx:ToggleButtonBar id="thisToggleBar"
dataProvider="{myArray}"
itemClick="showMsg(event.label)"/>
</s:VGroup> </s:Panel>
</s:Application>

ButtonSample

5、选单控件

外观:

代码:

<?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">
<fx:Script>
import mx.controls.Alert;
public function showMsg(msg:String):void
{
Alert.show(msg);
}
</fx:Script>
<fx:Declarations>
<s:RadioButtonGroup id="Spam"
itemClick="showMsg('User picked ' +
event.currentTarget.selectedValue)"/>
</fx:Declarations> <s:Panel width="400" height="150" title="SelecterSample" horizontalCenter="0" verticalCenter="0">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup>
<s:Label text="CheckBox" fontWeight="bold" backgroundColor="0xff0022"/>
<s:CheckBox id="cbVideoGames" label="Video Games"
click="showMsg('Video Games is ' + cbVideoGames.selected)"/>
<s:CheckBox id="cbFishing" label="Fishing"
click="showMsg('Fishing is ' + cbFishing.selected)"/>
</s:HGroup>
<s:HGroup> <s:Label fontWeight="bold" text="RadioButton" backgroundColor="0xff0022"/>
<s:RadioButton id="rbYes" value="Yes" groupName="Spam"
click="showMsg('Yes')" label="Yes"/>
<s:RadioButton id="rbNo" value="No" groupName="Spam"
click="showMsg('No')" label="No"/>
</s:HGroup> <s:HGroup>
<s:Label fontWeight="bold" text="DropDownList" backgroundColor="0xff0022"/>
<s:DropDownList id="combo"
close="showMsg('Favorite car is ' +
event.currentTarget.selectedItem)" >
<mx:ArrayCollection>
<fx:String>Ferrari</fx:String>
<fx:String>Porsche</fx:String>
<fx:String>Hyundai</fx:String>
</mx:ArrayCollection>
</s:DropDownList>
</s:HGroup> <s:HGroup>
<s:Label fontWeight="bold" text="ColorPicker" backgroundColor="0xff0022"/>
<mx:ColorPicker id="clr"
change="showMsg('Color ' +
event.currentTarget.selectedColor)"/>
</s:HGroup>
</s:Panel>
</s:Application>

SelecterSample

Flex_控件的更多相关文章

  1. JS调用Android、Ios原生控件

    在上一篇博客中已经和大家聊了,关于JS与Android.Ios原生控件之间相互通信的详细代码实现,今天我们一起聊一下JS调用Android.Ios通信的相同点和不同点,以便帮助我们在进行混合式开发时, ...

  2. HTML5 progress和meter控件

    在HTML5中,新增了progress和meter控件.progress控件为进度条控件,可表示任务的进度,如Windows系统中软件的安装.文件的复制等场景的进度.meter控件为计量条控件,表示某 ...

  3. 百度 flash html5自切换 多文件异步上传控件webuploader基本用法

    双核浏览器下在chrome内核中使用uploadify总有302问题,也不知道如何修复,之所以喜欢360浏览器是因为帮客户控制渲染内核: 若页面需默认用极速核,增加标签:<meta name=& ...

  4. JS与APP原生控件交互

    "热更新"."热部署"相信对于混合式开发的童鞋一定不陌生,那么APP怎么避免每次升级都要在APP应用商店发布呢?这里就用到了混合式开发的概念,对于电商网站尤其显 ...

  5. UWP开发必备:常用数据列表控件汇总比较

    今天是想通过实例将UWP开发常用的数据列表做汇总比较,作为以后项目开发参考.UWP开发必备知识点总结请参照[UWP开发必备以及常用知识点总结]. 本次主要讨论以下控件: GridView:用于显示数据 ...

  6. 【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~

    一.写在前面 自使用android studio开始,就被它独特的依赖方式:compile 'com.android.support:appcompat-v7:25.0.1'所深深吸引,自从有了它,麻 ...

  7. 对百度WebUploader开源上传控件的二次封装,精简前端代码(两句代码搞定上传)

    前言 首先声明一下,我这个是对WebUploader开源上传控件的二次封装,底层还是WebUploader实现的,只是为了更简洁的使用他而已. 下面先介绍一下WebUploader 简介: WebUp ...

  8. Windows API 设置窗口下控件Enable属性

    参考页面: http://www.yuanjiaocheng.net/webapi/create-crud-api-1-put.html http://www.yuanjiaocheng.net/we ...

  9. VB.NET设置控件和窗体的显示级别

    前言:在用VB.NET开发射频检测系统ADS时,当激活已存在的目标MDI子窗体时,被其他子窗体遮住了,导致目标MDI子窗体不能显示. 这个问题怎么解决呢?网上看到一篇帖子VB.NET设置控件和窗体的显 ...

随机推荐

  1. codeforces 711D Directed Roads(DFS)

    题目链接:http://codeforces.com/problemset/problem/711/D 思路:由于每个点出度都为1,所以没有复杂的环中带环.DFS遍历,若为环则有2^k-2种,若为链则 ...

  2. [翻译]Understanding Weak References(理解弱引用)

    原文 Understanding Weak References Posted by enicholas on May 4, 2006 at 5:06 PM PDT 译文 我面试的这几个人怎么这么渣啊 ...

  3. Lua与C++相互调用

    {--1.环境--} 为了快速入手,使用了小巧快速的vc++6.0编译器 以及在官网下载了Lua安装包..官网地址{--http://10.21.210.18/seeyon/index.jsp--} ...

  4. unity, 由scriptableObject创建.asset

    由继承自scriptableObject的类X创建.asset文件. 假设类X的定义为: [System.Serializable] public class X : ScriptableObject ...

  5. kafka2.9.2的伪分布式集群安装和demo(java api)测试

    目录: 一.什么是kafka? 二.kafka的官方网站在哪里? 三.在哪里下载?需要哪些组件的支持? 四.如何安装? 五.FAQ 六.扩展阅读   一.什么是kafka? kafka是LinkedI ...

  6. CSS id 选择器

    id 选择器 id 选择器可以为标有特定 id 的 HTML 元素指定特定的样式. id 选择器以 "#" 来定义. 下面的两个 id 选择器,第一个可以定义元素的颜色为红色,第二 ...

  7. EXCEL datatable 根据列名自动写入到相应属性、字段或列中

    string path = openFileDialog1.FileName; try { DataTable dt = ExcelHelper.ExcelInput(path); ; ; ; ; i ...

  8. bower安装使用入门详情

    bower安装使用入门详情   bower自定义安装:安装bower需要先安装node,npm,git全局安装bower,命令:npm install -g bower进入项目目录下,新建文件1.tx ...

  9. SQL Server 2012 创建数据库快照

    不是所有的MSSQL数据库版本都支持数据库快照,只有Enterprise版本的才支持. 在其他版本上,以Business Intelligence Edition版本为例,创建快照时,会报如下错误 消 ...

  10. [HTML5]原生事件绑定和jquery动态事件绑定的区别

    原生事件绑定: <!-- 标签上绑定的事件是由window对象帮助调用,因此方法内的this其实是window对象 --> <label><input type=&quo ...