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. Flocker 做为后端存储代理 docker volume-driver 支持

    docker Flocker https://github.com/ClusterHQ/flocker/ 文档: https://docs.clusterhq.com/en/latest/docker ...

  2. HDU 4638 (莫队)

    题目链接:Problem - 4638 做了两天莫队和分块,留个模板吧. 当插入r的时候,设arr[r]代表r的位置的数字,判断vis[arr[r-1]]和vis[arr[r+1]]是否访问过,如果两 ...

  3. Spring 笔记1

    1.在java开发领域,Spring相对于EJB来说是一种轻量级的,非侵入性的Java开发框架,曾经有两本很畅销的书<Expert one-on-one J2EE Design and Deve ...

  4. Android源码之Gallery专题研究(1)

    前言 时光飞逝,从事Android系统开发已经两年了,总想写点什么来安慰自己.思考了很久总是无法下笔,觉得没什么好写的.现在终于决定写一些符合大多数人需求的东西,想必使用过Android手机的人们一定 ...

  5. 高并发数据库之MySql性能优化

    1.慢查询 SHOW VARIABLES LIKE '%quer%'

  6. jquery.elevateZoom实现仿淘宝看图片,一张小的,一张大用于鼠标经过时候显示

    实现这个效果你需要准备两张图片,一张小的,一张大用于鼠标经过时候显示.然后我们只要为img标签添加data-zoom-image属性,其值为大图的地址,最后在javascript中选择该图片调用ele ...

  7. nginx keepalived 主从切换

    注:  LVS + Keepalived  不知道为什么出现一个很郁闷的问题....... ------------------------------------------------------ ...

  8. Ubuntu Apache2 配置简单介绍

    debian系列的(如Ubuntu,本人是Ubuntu 12.04的)Apache 通过 apt-get 方式安装的是 Apache2 的,是 httpd 的 2.x 版本,名字直接叫 apache2 ...

  9. C++中string

    之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必 担心内存是否足够.字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至 ...

  10. BZOJ 1653 [Usaco2006 Feb]Backward Digit Sums ——搜索

    [题目分析] 劳逸结合好了. 杨辉三角+暴搜. [代码] #include <cstdio> #include <cstring> #include <cmath> ...