加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flash builder 4 表格\ viewstack 布局

发布时间:2020-12-15 06:54:56 所属栏目:百科 来源:网络整理
导读:? ?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" minWidth="955" minHeight="600" s:layout s:VerticalLayout ho
?

<?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" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
private var a:ArrayCollection=new ArrayCollection([{id:"0",name:"dog"},{id:"1",name:"dog1"},{id:"2",name:"dog2"}]);
]]>
</fx:Script>
<mx:DataGrid id="dg" dataProvider="{a}">
<!--<mx:columns>
<mx:DataGridColumn headerText="列 1" dataField="col1"/>
<mx:DataGridColumn headerText="列 2" dataField="col2"/>
<mx:DataGridColumn headerText="列 3" dataField="col3"/>
</mx:columns>-->
</mx:DataGrid>

</s:Application>

如果不注释<mx:columns>的话,headerText相当于表头,而将dataField="name",则显示a中对应那一列的name值;

如果有<mx:columns>,则显示其中的内容而非dataProvider的。若没有,private var a:ArrayCollection=new ArrayCollection([{id:"0",name:"dog2"}]);中共有3行两列,列名为"id","name",行的顺序为变量声明时对象的排列顺序。

?

?

viewstack导航器代码:

?

<?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" minWidth="955" minHeight="600">
?<s:layout>
??<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
?</s:layout>

?

?<fx:Declarations> ??<!-- 将非可视元素(例如服务、值对象)放在此处 --> ?</fx:Declarations> ?<mx:ViewStack id="viewstack1" width="200" height="200" selectedIndex="0"> ??<s:NavigatorContent label="视图 1" width="100%" height="100%"> ???<s:Button click="viewstack1.selectedIndex=1" label="biaoqian1"/> ??</s:NavigatorContent> ??<s:NavigatorContent label="标签1" width="100%" height="100%"> ???<s:Button click="viewstack1.selectedIndex=0" label="biaoqian2"/> ??</s:NavigatorContent> ??<s:NavigatorContent label="标签2" width="100%" height="100%"> ??</s:NavigatorContent> ?</mx:ViewStack> </s:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读