[译] 在Spark的容器组件中使用Halo(mx)的导航组件

Posted by wpm on Feb 21, 2010 in Flex, Translations |
  • 资讯类型: 翻译
  • 来源页面: http://www.tink.ws/blog/using-spark-containers-in-mx-navigators/
  • 资讯原标题: Using Spark Containers in MX Navigators
  • 资讯原作者:
  • 我很喜欢使用mx的导航组件:如ViewStack, TabNavigator等,然而当我们将这些导航组件添加到spark的容器中的时候会出现以下错误提示:
    The children of Halo navigators must implement INavigatorContent.
    解决的办法有以下两种:
    1.自己去封装新的spark容器
    2.使用spark的NavigatorContent组件( NavigatorContent 扩展了spark的SkinnableContainer ,所以你可以把它当成组或者自定义布局来使用)。

    1. <?xml version=”1.0″ encoding=”utf-8″?>
    2. <s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
    3.                xmlns:s=”library://ns.adobe.com/flex/spark”
    4.                xmlns:mx=”library://ns.adobe.com/flex/mx”
    5.                minWidth=”955″ minHeight=”600″>
    6.         <s:layout>
    7.                 <s:VerticalLayout/>
    8.         </s:layout>
    9.         <mx:ViewStack id=”vs” width=”400″ height=”200″>
    10.         <s:NavigatorContent width=”100%” height=”100%” backgroundColor=”0xFF0000″>
    11.                 <s:layout>
    12.                         <s:VerticalLayout/>
    13.                 </s:layout>
    14.                 <s:Button label=”vertical button 1″/>
    15.                 <s:Button label=”vertical button 2″/>
    16.                 <s:Button label=”vertical button 3″/>
    17.         </s:NavigatorContent>
    18.         <s:NavigatorContent width=”100%” height=”100%” backgroundColor=”0x0000FF”>
    19.                 <s:layout>
    20.                         <s:HorizontalLayout/>
    21.                 </s:layout>
    22.                 <s:Button label=”horizontal button 1″/>
    23.                 <s:Button label=”horizontal button 2″/>
    24.                 <s:Button label=”horizontal button 3″/>
    25.         </s:NavigatorContent>
    26.         </mx:ViewStack>
    27.         <mx:ToggleButtonBar dataProvider=”{vs}”/>
    28. </s:Application>

    Tags: , , ,