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的更多相关文章

  1. css -- 布局元素

    默认情况下拥有布局的元素:HTML ,table,tr,td,img,hr,input,select,textarea,button,iframe,embed,object,applet,marque ...

  2. 第六十四节,html文档布局元素

    html文档布局元素 学习要点:     1.文档元素总汇     2.文档元素解析     本章主要探讨HTML5中文档元素,文档元素的主要作用是划分各个不同的内容,让整个布局清晰明快.让整个布局元 ...

  3. THML文档布局元素

    学习要点:     1.文档元素总汇     2.文档元素解析 一.文档元素总汇     文档元素基本没有什么实际作用效果,主要目的是在页面布局时区分各个主题和概念.         元素名称     ...

  4. html5--2.9新的布局元素(6)-figure/figcaption

    html5--2.9新的布局元素(6)-figure/figcaption 学习要点 了解figure/figcaption元素的语义和用法 通过实例理解figure/figcaption元素的用法 ...

  5. html5--2.9新的布局元素(5)-hgroup/address

    html5--2.9新的布局元素(5)-hgroup/address 学习要点 了解hgroup/address元素的语义和用法 通过实例理解hgroup/address元素的用法 对照新元素布局与d ...

  6. html5--2.7新的布局元素(4)-time

    html5--2.7新的布局元素(4)-time 学习要点 了解微格式的概念 掌握time元素的用法 微格式的概念 HTML5中的微格式,是一种利用HTML5中的新标签对网页添加附加信息的方法,附加信 ...

  7. html5--2.6新的布局元素(5)-nav

    html5--2.6新的布局元素(4)-aside/nav 学习要点 了解aside/nav元素的语义和用法 通过实例理解aside/nav元素的用法 aside元素 aside元素通常用来设置侧边栏 ...

  8. html5--2.5新的布局元素(4)-aside/nav

    html5--2.5新的布局元素(4)-aside/nav 学习要点 了解aside/nav元素的语义和用法 通过实例理解aside/nav元素的用法 aside元素(附属信息) aside元素通常用 ...

  9. html5--2.4新的布局元素(3)-section

    html5--2.4新的布局元素(3)-section 学习要点 了解section元素的语义和用法 通过实例理解section元素的用法 article元素和section元素的区别和共同点 art ...

随机推荐

  1. 三列布局,读《css那些事儿》

    1.两列定宽,中间自适应 要点:浮动.负边距效果.mainbox增加内容div并设置margin.:after清除浮动 原理:mainbox的浮动并将其宽度设置为100%,次要内容及侧边栏设置固定宽度 ...

  2. Spring MVC 与ExtJS完美集成

    http://blog.csdn.net/q262800095/article/details/12021191 http://www.jb51.net/article/25267.htm

  3. 定时且周期性的任务研究I--Timer

    很多时候我们希望任务可以定时的周期性的执行,在最初的JAVA工具类库中,通过Timer可以实现定时的周期性的需求,但是有一定的缺陷,例如:Timer是基于绝对时间的而非支持相对时间,因此Timer对系 ...

  4. IFeatureWorkspace OpenFeatureClass Example(转)

    网络来源:http://changqingnew.blog.163.com/blog/static/1075233820103383633639/ //IFeatureWorkspace OpenFe ...

  5. ural1470 UFOs

    UFOs Time limit: 2.0 secondMemory limit: 64 MB Vasya is a ufologist and his duties include observing ...

  6. SQL复习三(子查询)

    子查询 子查询就是嵌套查询,即select中包含这select,如果一条语句中存在着两个,或者两个以上的select,那么就是子查询语句了. 子查询出现的位置 where后,作为条件的一部分: fro ...

  7. 多机并行计算框架 和CoolHash数据库(可用于多机机器学习)

    http://my.oschina.net/fourinone/blog/289122 http://www.oschina.net/p/fourinone

  8. The 2014 ACMICPC Asia Regional Xian Online

    [A]签到题 [B]后缀数组 [C]染色,DP(感觉可出) [D]BFS搜索,有点麻烦 [E]博弈论,Nim博弈 [F]BFS状态搜索 [G]概率DP+状态压缩 [H]异或+构造 [I]矩阵快速幂(队 ...

  9. The 2014 ACM-ICPC Asia Regional Anshan Online

    [A]无向图的双联通子图计数.DP+状态压缩 [B]计算几何(点的旋转) [C]DP+状态压缩 [D]离散数学+DP (感觉可出) [E]概率DP [F]LCT模板题(-_-///LCT是啥!!!!) ...

  10. C++------------typedef 函数指针类型定义

    摘要bycrazyhacking:        typedef 是定义了一种"函数指针"类型,可以再声明很多变量.函数指针的定义是定义了一个变量. int max(int x,i ...