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. ExtJS4.1自带API打不开的问题解决

    在ext官网个下载的最新版本的extjs,本来想看看里面的docs文档的,结果却发现打不开,总是转个不停,于是就打开index.html的源码,看到引入ext的js文件的时候,看到引入的是ext.js ...

  2. Android - Get Bluetooth UUID for this device

    Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join th ...

  3. document.createElement方法的使用

    我们在使用createElemen方法t创建一个元素节点的时候,似乎在IE下面怎么写都可以,但切换到FF等其它浏览器却总是会报错. 比如我们要创建一个input元素,那么在IE下,我们可以有多种写法: ...

  4. windows下常用软件

    1  pdf转word solid converter pdf  特点:功能强大,能转换页面页眉等,还有表格.

  5. eclipse shortcut binding

    有些真的是太方便了,我竟然不知道,比如ctrl + h 就是打开search 功能,包括file search,我竟然每次都点击工具条上的放大镜图标! use Ctrl+Shift+T for ope ...

  6. PAT (Advanced Level) 1001. A+B Format (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  7. 前端设计——js实现图片切换的淡入淡出

    1.网页结构如图所示 2.页面布局设计细节 ①分块:一个小方块是一个div. ②无序列表一般是竖直排放的,可以通过float让其水平排放.float:left; ③三个小方块是浮动上去的,所以要用到p ...

  8. java 并发多线程异步

    http://www.cnblogs.com/dolphin0520/category/602384.html   并发 http://blog.csdn.net/column/details/con ...

  9. LPC2478中断控制器以及串口详解

    LPC2478的中断系统 LPC2478使用的是ARM PrimeCell向量中断控制器,一共支持32个中断向量,处于AHB空间便于系统快速访问,在中断向量的硬件优先级上还有一层可以用户自己设计的软件 ...

  10. iOS开发UITableView基本使用方法总结

    本文为大家呈现了iOS开发中UITableView基本使用方法总结.首先,Controller需要实现两个delegate ,分别是UITableViewDelegate 和UITableViewDa ...