Flex4 布局 元素index
Flex4 布局 元素index
<?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"
height="730">
<s:layout>
<s:BasicLayout/>
</s:layout> <fx:Script>
<![CDATA[
protected function btn001_clickHandler(event:MouseEvent):void{
trace(win001.getElementIndex(btn001));
win001.setElementIndex(btn001,0);
}
protected function btn002_clickHandler(event:MouseEvent):void{
var lbl:Label = new Label();
lbl.text = 'created label';
win001.addElement(lbl);
} protected function btn003_clickHandler(event:MouseEvent):void{
win001.removeElement(btn002);
var getChildAt2:DisplayObject = win001.getChildAt(0);
trace(getChildAt2);
} protected function btn004_clickHandler(event:MouseEvent):void{
win001.swapElements(lbl002,lbl003);
} protected function btn005_clickHandler(event:MouseEvent):void{
var lbl002Index:int = win001.getElementIndex(lbl002);
var lbl003Index:int = win001.getElementIndex(lbl003);
trace(lbl002Index);
trace(lbl003Index);
win001.swapElementsAt(lbl002Index,lbl003Index);
} ]]>
</fx:Script> <fx:Declarations>
<s:RadioButtonGroup id="radiogroup1"/>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<!-- 选中text之后,再点击别的地方,才会出现提示,仅有空格都不行,会有默认消息 -->
<mx:StringValidator source="{txt001}" id="vld001" property="text" requiredFieldError="ABC...">
</mx:StringValidator>
<!-- 不输入不会出提示,输入一个会有提示,两个空格就可以 -->
<mx:StringValidator source="{txt002}" id="vld002" property="text" required="false" minLength="2" tooShortError="DEF..." >
</mx:StringValidator>
</fx:Declarations>
<s:Form x="316" y="21" width="240" height="187">
<s:FormHeading label="In a Form"/>
<s:FormItem label="标签" required="true">
<s:TextInput id="txt001"/>
</s:FormItem>
<s:RadioButton label="按钮 1" groupName="radiogroup1"/>
<s:RadioButton label="按钮 2" groupName="radiogroup1"/>
<s:FormItem label="标签">
<s:TextInput id="txt002"/>
</s:FormItem>
</s:Form>
<s:Panel x="27" y="21" width="250" height="158" title="This is panel">
<s:TileGroup x="10" y="10" width="228" height="105">
<s:Label text="In a TileGroup"/>
<s:Button label="按钮"/>
<s:CheckBox label="复选框"/>
<mx:ColorPicker/>
<mx:DateField formatString="YYYY-MM-DD" yearNavigationEnabled="true"/>
</s:TileGroup>
</s:Panel>
<s:TitleWindow id="win001" x="27" y="216" width="250" height="200" title="This is TitleWindow">
<s:Label id="lbl001" x="23" y="20" backgroundColor="#EE1717" text="in the titleWindow"/>
<s:Button id="btn001" x="96" y="12" label="get/setElementIndex" click="btn001_clickHandler(event)"/>
<s:Label id="lbl002" x="23" y="40" backgroundColor="#16FE04" text="this is green"/>
<s:Label id="lbl003" x="66" y="40" backgroundColor="#FFFF00" text="this is yellow"/>
<s:Button id="btn002" x="19" y="60" label="addElement" click="btn002_clickHandler(event)"/>
<s:Button id="btn003" x="114" y="60" label="removeElement" click="btn003_clickHandler(event)"/>
<s:Button id="btn004" x="20" y="89" label="swapElements" click="btn004_clickHandler(event)"/>
<s:Button id="btn005" x="20" y="118" label="swapElementsAt" click="btn005_clickHandler(event)"/>
<s:Spacer x="161" y="42" width="43" height="10"/>
</s:TitleWindow>
<s:TileGroup x="316" y="216" width="240" height="200" paddingTop="5">
<s:Label text="In a TileGroup"/>
<s:Spacer width="10" height="10"/>
</s:TileGroup>
<s:SkinnableContainer x="578" y="21" width="152" height="158">
<s:Label x="10" y="27" text="In a SkinnableContainer"/>
<s:Line x="11" y="48" width="116" height="71" xTo="40">
<s:stroke>
<s:SolidColorStroke color="black" weight="2"> </s:SolidColorStroke>
</s:stroke>
</s:Line>
</s:SkinnableContainer>
<s:HGroup x="578" y="216" width="152" height="78" paddingTop="5">
<s:Label text="inHGroup"/>
<s:Button label="按钮"/>
<s:Button label="按钮"/>
</s:HGroup>
<s:VGroup x="578" y="329" width="152" height="87" horizontalAlign="contentJustify" paddingLeft="5" paddingTop="5" verticalAlign="top">
<s:Label text="inVGroup"/>
<s:Button label="按钮"/>
<s:Button label="按钮"/>
</s:VGroup>
<s:Panel x="23" y="438" width="250" height="200" title="mx:HDividedBox和mx:VDividedBox">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<mx:HDividedBox width="100%" height="100%">
<s:BorderContainer height="100%" width="25%">
</s:BorderContainer>
<s:BorderContainer height="100%" width="75%">
<mx:VDividedBox width="100%" height="100%">
<s:BorderContainer height="100%" width="100%">
</s:BorderContainer>
<s:BorderContainer height="100%" width="100%">
</s:BorderContainer>
<s:BorderContainer height="100%" width="100%">
</s:BorderContainer>
</mx:VDividedBox>
</s:BorderContainer>
</mx:HDividedBox>
</s:Panel>
<s:Panel right="193" bottom="92" width="250" height="200" title="基于约束的布局">
<s:Button left="20" right="158" top="21" bottom="125" label="按钮" horizontalCenter="-69" verticalCenter="-52"/>
</s:Panel>
</s:Application>
Flex4 布局 元素index的更多相关文章
- css -- 布局元素
默认情况下拥有布局的元素:HTML ,table,tr,td,img,hr,input,select,textarea,button,iframe,embed,object,applet,marque ...
- 第六十四节,html文档布局元素
html文档布局元素 学习要点: 1.文档元素总汇 2.文档元素解析 本章主要探讨HTML5中文档元素,文档元素的主要作用是划分各个不同的内容,让整个布局清晰明快.让整个布局元 ...
- THML文档布局元素
学习要点: 1.文档元素总汇 2.文档元素解析 一.文档元素总汇 文档元素基本没有什么实际作用效果,主要目的是在页面布局时区分各个主题和概念. 元素名称 ...
- html5--2.9新的布局元素(6)-figure/figcaption
html5--2.9新的布局元素(6)-figure/figcaption 学习要点 了解figure/figcaption元素的语义和用法 通过实例理解figure/figcaption元素的用法 ...
- html5--2.9新的布局元素(5)-hgroup/address
html5--2.9新的布局元素(5)-hgroup/address 学习要点 了解hgroup/address元素的语义和用法 通过实例理解hgroup/address元素的用法 对照新元素布局与d ...
- html5--2.7新的布局元素(4)-time
html5--2.7新的布局元素(4)-time 学习要点 了解微格式的概念 掌握time元素的用法 微格式的概念 HTML5中的微格式,是一种利用HTML5中的新标签对网页添加附加信息的方法,附加信 ...
- html5--2.6新的布局元素(5)-nav
html5--2.6新的布局元素(4)-aside/nav 学习要点 了解aside/nav元素的语义和用法 通过实例理解aside/nav元素的用法 aside元素 aside元素通常用来设置侧边栏 ...
- html5--2.5新的布局元素(4)-aside/nav
html5--2.5新的布局元素(4)-aside/nav 学习要点 了解aside/nav元素的语义和用法 通过实例理解aside/nav元素的用法 aside元素(附属信息) aside元素通常用 ...
- html5--2.4新的布局元素(3)-section
html5--2.4新的布局元素(3)-section 学习要点 了解section元素的语义和用法 通过实例理解section元素的用法 article元素和section元素的区别和共同点 art ...
随机推荐
- 有关sqlitedrop数据库重建比delete方式来清空数据库更加有效率
今天浏览stackoverflow 发现一个有趣的问题: which was more preferable as performance wise and without error cause t ...
- docker k8s 1.3.8 + flannel
docker k8s + flannel kubernetes 是谷歌开源的 docker 集群管理解决方案. 项目地址: http://kubernetes.io/ 测试环境: node-1: 10 ...
- Django之路: 模版篇
一.Django 模版 上章是介绍简单的把django.http.HttpResponse的内容显示到网页上,下面就介绍以下如何使用渲染模版的方法来显示内容.本节代码是基于Django 1.8,但 ...
- FM收音机 RDS的强大功能
FM收音机 RDS的强大功能 分类: MTK2011-04-26 16:06 14889人阅读 评论(6) 收藏 举报 交通公告体育音乐娱乐教育 前言 随着发展,会有越来越多的电台具有RDS广播功能, ...
- Laravel邮件发送问题小解
在Laravel中已经有内置了发送邮件的功能,通过 Mail::send 可发送邮件,但要使用这个函数必须先进行相关配置. 在 /app/config/mail.php 中设置你的邮件参数,如下: 1 ...
- mongodb学习(五) 查询
1. 按条件查询: db.users.find({"name":"MM1"}) 2.find的第二个参数可以指定要返回的字段:这里1 表示要显示的字段,0 表示 ...
- ecshop中ajax的调用原理 1
ecshop中ajax的调用原理 1:首先ecshop是如何定义ajax对象的. ecshop中的ajax对象是在js/transport.js文件中定义的.里面是ajax对象文件.声明了一个va ...
- Practice Round China New Grad Test 2014 报告
今天有Google of Greater China Test for New Grads of 2014的练习赛,主要是为了过几天的校园招聘测试做练习用的,帮助熟悉平台,题目嘛,个人觉得除了A题外, ...
- imageX及其安装windows
/capture 将卷映像捕获到新 WIM 文件中(备份成wim) imagex /capture g: e:\7setted.wim "Drive G" /apply ...
- kafkaspout以及kafkabolt的最简实例
这个实例中有一个KafkaSpout,一个KafkaBolt,一个自定义Bolt QueryBolt.数据流程是KafkaSpout从topic为recommend的消息队列中取出St ...