View Stack容器,按钮选择子容器

Posted on 2013-07-31 09:12  诸葛小北  阅读(198)  评论(0编辑  收藏  举报
<?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:Panel title="ViewStack 容器的样例"
             width="75%" height="75%"
             horizontalCenter="0" verticalCenter="0">
        <s:VGroup left="10" right="10" top="10" bottom="10">
            <s:Label width="100%" color="blue"
                     text="用按钮改变子容器"/>
            
            <s:HGroup>
                <s:Button id="searchButton" label="搜索按钮"
                          click="myViewStack.selectedChild = search;"/>
                <s:Button id="cInfoButton" label="效果预览"
                          click="myViewStack.selectedChild = custInfo;"/>
                <s:Button id="aInfoButton" label="台站信息"
                          click="myViewStack.selectedChild = accountInfo;"/>
            </s:HGroup>
            
            <!-- Define the ViewStack and the three child containers and have it
            resize up to the size of the container for the buttons. -->
            <mx:ViewStack id="myViewStack" borderStyle="solid" width="100%" height="100%">
                <mx:Canvas id="search" backgroundColor="#FFFFCC" label="Search" width="100%" height="100%">
                    <mx:Label text="搜索信息--搜索信息--搜索信息--搜索信息--搜索信息--搜索信息" color="#000000"/>
                </mx:Canvas>
                <mx:Canvas id="custInfo" backgroundColor="#CCFFFF" label="Customer Info" width="100%" height="100%">
                    <mx:Label text="效果预览--效果预览--效果预览--效果预览--效果预览--效果预览--" color="#000000"/>
                </mx:Canvas>
                <mx:Canvas id="accountInfo" backgroundColor="#FFCCFF" label="Account Info" width="100%" height="100%">
                    <mx:Label text="台站信息--台站信息--台站信息--台站信息--台站信息--台站信息--台站信息--" color="#000000"/>
                </mx:Canvas>
            </mx:ViewStack>            
        </s:VGroup>
    </s:Panel>
             
</s:Application>
View Code

Copyright © 2024 诸葛小北
Powered by .NET 8.0 on Kubernetes