mardi 28 février 2017

how to make a native menu in a AS3 class which extends the WindowedApplication class

We all know how to define a native menu using XML in MXML. It looks like this:

<s:WindowedApplication xmlns:fx="http://ift.tt/rYUnH9"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Declarations>
    <!-- The xml data provider for menu -->
    <fx:XML format="e4x" id="menuData">
        <root>
            <menuitem label="File">
                <menuitem label="Open"/>
                <menuitem label="Save"/>
            </menuitem>
            <menuitem label="Help"/>
        </root>
    </fx:XML>
</fx:Declarations>
<s:menu>
    <mx:FlexNativeMenu dataProvider="{menuData}" labelField="@label" showRoot="false"/>
</s:menu>   

But I need to make a native menu(application menu) using a loaded XML in a class which extends the WindowedApplication class and is extended by the main MXML. How can I do this? Thanks for any help in advance!

Aucun commentaire:

Enregistrer un commentaire