flex 学习篇 导航类容器

 
 

导航类容器需要使用<mx:ViewStack />。可以直接从ui设计器中拉控件过去舞台或者手动敲代码。

导航类容器就是相当于创建了一个菜单,然后按每个选项都可以进入到不同的页面。

  1. 创建了<mx:ViewStack>之后需要为它指定id号。
    <mx:ViewStack id="viewstack1" x="343" y="237" width="264" height="223">
  2. 导航里面的每个页面都需要包含在各自的<s:NavigatorContent>中。
     1   <s:NavigatorContent width="100%" height="100%" label="视图 1">
    2 <s:CheckBox x="105" y="93" label="复选框"/>
    3 </s:NavigatorContent>
    4 <s:NavigatorContent width="100%" height="100%" label="ff">
    5 <s:Panel x="14" y="13" width="250" height="200">
    6 </s:Panel>
    7 </s:NavigatorContent>
    8 <s:NavigatorContent width="100%" height="100%" label="ss">
    9 <s:Button x="118" y="88" label="按钮"/>
    10 </s:NavigatorContent>
    </mx:ViewStack>
  3. 页面创建好了之后,就需要创建按钮给用户提供切换页面的选项。使用到了<s:ButtonBar>,需要为该类提供ViewStack类的ID号。该ButtonBar类需要放在Application类和ViewStack类之间。
    1 <s:Application>
    2 ........
    3 <s:ButtonBar y="229" left="364" width="206" dataProvider="{viewstack1}"/>
    4 <mx:ViewStack id="viewstack1">
    5 ............




 
原文地址:https://www.cnblogs.com/pandaXiong/p/2348052.html