0

メイン アプリケーション mxml タブ ナビゲーターを使用しています。次のコードで、アプリケーションのどこからでもそのタブ ナビゲーターにアクセスできます。

mx.core.FlexGlobals.topLevelApplication.menuOption.selectedIndex=0;

今私の問題は、タブナビゲーターの子要素であるトランザクションUIでトグルボタンバーを使用したことです.上記のコードのようにその要素にアクセスするにはどうすればよいですか??

メインの mxml タブ ナビゲーター ::

<mx:TabNavigator   left="10" top="20" bottom="10" right="10" id="menuOption" >

    <ui1:homeUI label="Home" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" /> 

    <ui1:transactionUI label="Transaction" width="100%" height="100%" backgroundColor="#373737"  />     

        <ui1:calanderUI label="Employee service" width="100%" height="100%"  horizontalCenter="0"  backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />
        <ui1:ManagementUI label="Management" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />
        <ui1:reportUI label="Reports" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />

        <ui1:admin label="Admin" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />

    </mx:TabNavigator>

私のメイン アプリケーション mxml では、タブ ナビゲーターを使用しています。コードに従って、アプリケーション内のどこからでもそのタブ ナビゲーターにアクセスできます。

mx.core.FlexGlobals.topLevelApplication.menuOption.selectedIndex=0;

今私の問題は、タブナビゲーターの子要素であるトランザクションUIでトグルボタンバーを使用したことです.上記のコードのようにその要素にアクセスするにはどうすればよいですか??

メインの mxml タブ ナビゲーター ::

<ui1:homeUI label="Home" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" /> 

<ui1:transactionUI label="Transaction" width="100%" height="100%" backgroundColor="#373737"  />     

    <ui1:calanderUI label="Employee service" width="100%" height="100%"  horizontalCenter="0"  backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />
    <ui1:ManagementUI label="Management" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />
    <ui1:reportUI label="Reports" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />

    <ui1:admin label="Admin" width="100%" height="100%" backgroundColor="#373737" chromeColor="#181818" contentBackgroundColor="#181818" color="#FDFDFD" />

</mx:TabNavigator>

* transactionUI 内のトグル バー :: *

<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"
                xmlns:ui="com.colan.*" xmlns:ui1="com.colan.ui.*"
                backgroundColor="#373737" chromeColor="#181818" 
                contentBackgroundColor="#181818" color="#FDFDFD">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
    <![CDATA[

        import mx.collections.*;
        import mx.core.*;
    ]]>
</fx:Script>
<mx:VBox horizontalAlign="center"  verticalAlign="middle" width="100%"  height="100%">

    <mx:HBox horizontalAlign="center"  verticalAlign="middle" width="100%"  height="15%" >

        <mx:ToggleButtonBar id="toggleButtonBar"
                            dataProvider="{viewStack}"    
                            selectedButtonTextStyleName="mySelectedButtonTextStyleName"
                            />


    </mx:HBox>
    <mx:HBox horizontalAlign="center"  verticalAlign="middle" width="100%"  height="85%" >


        <mx:ViewStack id="viewStack"                 
                      visible="{toggleButtonBar.selectedIndex > -1}" width="100%"  height="100%" >

            <ui1:transaction label="Transaction"/>
            <ui1:addClient label="Add  Client"/>
            <ui1:invoice label="Make invoice"/>
            <ui1:workCatalogue label="Work catalogue"/>
            <ui1:productCataloge label="Products Categories"/>

            <ui1:suppliers label="Offers"/>
            <ui1:calendarPlanUI label="Calendar"/>


        </mx:ViewStack>
    </mx:HBox>
</mx:VBox>

アドバイスお願いします...

4

1 に答える 1

0

((mx.core.FlexGlobals.topLevelApplication.menuOption).getChildAt(1) as transactionUI).toggleButtonBar

これは大雑把ですが、作業を進めるのに役立ちます。テストしていません。

于 2013-03-27T21:31:47.690 に答える