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. nl2br() 函数

    nl2br() 函数在字符串中的每个新行 (\n) 之前插入 HTML 换行符 (<br />).经常用于在线编辑的内容,以便显示. 用法:nl2br(string) 参数 描述 stri ...

  2. Caffe proto閱讀

    --------------------------------------------------------------------------------- 1.Data Layer sourc ...

  3. logback配置错误邮件发送

    配置logback发送error级别日志到指定邮箱 需要导入jar包:janino.jar <property name="smtpHost" value="smt ...

  4. 一些JavaScript的技巧、秘诀和最佳实践

    文章分享一些JavaScript的技巧.秘诀和最佳实践,除了少数几个外,不管是浏览器的JavaScript引擎,还是服务器端JavaScript解释器,均适用. 本文中的示例代码,通过了在Google ...

  5. 关于 Unix 用户权限及进程权限及 Saved set-user-id

    最近在看APUE,看到3.14节,fcntl的时候#include <fcntl.h>int fcntl(int fd, int cmd, .../* int arg */);出错返回-1 ...

  6. CheckBoxList 用法

    <asp:CheckBoxList ID="cblqf" ForeColor="#4d6fc8" runat="server" Rep ...

  7. Linux版网易云音乐播放音乐时无限显示“网络错误”的解决办法

    安装 gstreamer0.10-plugins-good debian类系统: -plugins-good

  8. rabin 素性检验 随机化算法

    #include <cstdio> #include <cstdlib> #include <ctime> typedef long long int LL; in ...

  9. 解决IIS7该问.svc文件的错误问题

    解决IIS7.5中部署WCF时,访问.svc文件的404错误问题如果你直接在IIS 7中配置WCF,访问.svc文件时会出现404错误.解决方法,以管理员身份进入命令行模式,运行:"%win ...

  10. Android服务之Service(其一)

    android中服务是运行在后台的东西,级别与activity差不多.既然说service是运行在后台的服务,那么它就是不可见的,没有界面的东西.你可以启动一个服务Service来播放音乐,或者记录你 ...