Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:48:40+00:00 2026-06-02T18:48:40+00:00

I work with Flash buider 4.6 and I like to mimic Mac Os Application

  • 0

I work with Flash buider 4.6 and I like to mimic Mac Os Application menu for my AIR application.
In this menu, I’d like to add : About MyAPP, Hide MyApp and Hide Others.

For the first command, no problem, but I don’t know how to proceed to do hide and hide other with AS3 command.

Can you help me solve this problem.

Thanks

See below an example

<?xml version="1.0" encoding="utf-8"?>

<fx:Script>

    <![CDATA[
        import mx.controls.Alert;

        // Preserve the original menus for the purposes of this demo (MacOS)
        private var oldMenu:NativeMenu = NativeApplication.nativeApplication.menu;
        private var newWindow:NativeWindow;

        private function showMenus():void
        {
            //For Windows
            if (NativeWindow.supportsMenu)
            {
                // On Windows, we need to create a window so we can add a menu (Tour de Flex has no Chrome)
                var options:NativeWindowInitOptions = new NativeWindowInitOptions(); 
                options.systemChrome = NativeWindowSystemChrome.STANDARD; 
                options.transparent = false; 
                newWindow = new NativeWindow(options); 
                newWindow.width = 500; 
                newWindow.height = 100; 
                newWindow.title = "Demonstration of Native Menus for Windows applications";
                newWindow.menu = createMenu();
                newWindow.alwaysInFront = true; 
                newWindow.activate();    

                msg.text = "Window Menu (Windows) - A NativeWindow has been created to demonstrate the menu";
            }

            // On MacOS, replace the current app menu with our new menu
            if (NativeApplication.supportsMenu)
            {
                // In 
                NativeApplication.nativeApplication.menu = createMenu();
                msg.text = "Application Menu (MacOS) - The Application menu has been replaced with demo menu";
            }
        }

        private function createMenu():NativeMenu
        {
            var menu:NativeMenu = new NativeMenu();
            var menuItem1:NativeMenuItem = new NativeMenuItem("Takeoff");
            menuItem1.submenu = createTakeoffMenu();
            menuItem1.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(menuItem1);

            var menuItem2:NativeMenuItem = new NativeMenuItem("Landing");
            menuItem2.submenu = createLandingMenu();
            menuItem2.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(menuItem2);
            return menu;
        }

        private function createTakeoffMenu():NativeMenu
        {
            var menu:NativeMenu = new NativeMenu();
            var takeoffItem1:NativeMenuItem = new NativeMenuItem("Gear Up");
            takeoffItem1.checked = true;
            takeoffItem1.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(takeoffItem1);
            var takeoffItem2:NativeMenuItem = new NativeMenuItem("Retract Flaps");
            takeoffItem2.checked = true;
            takeoffItem2.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(takeoffItem2);
            return menu;
        }

        private function createLandingMenu():NativeMenu
        {
            var menu:NativeMenu = new NativeMenu();
            var landingItem1:NativeMenuItem = new NativeMenuItem("Gear Down");
            landingItem1.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(landingItem1);
            var landingItem2:NativeMenuItem = new NativeMenuItem("Extend Flaps");
            landingItem2.addEventListener(Event.SELECT, selectHandler);
            menu.addItem(landingItem2);
            var landingItem3:NativeMenuItem = new NativeMenuItem("Shutdown");
            landingItem3.addEventListener(Event.SELECT, selectHandler);

            var shutdownMenu:NativeMenu = new NativeMenu();


            // Create submenu
            var shutdownItem1:NativeMenuItem = new NativeMenuItem("Turn off avionics");
            shutdownItem1.addEventListener(Event.SELECT, selectHandler);
            shutdownMenu.addItem(shutdownItem1);

            var shutdownItem2:NativeMenuItem = new NativeMenuItem("Pull Mixture");
            shutdownItem2.addEventListener(Event.SELECT, selectHandler);                
            shutdownMenu.addItem(shutdownItem2);            

            var shutdownItem3:NativeMenuItem = new NativeMenuItem("Turn off Mags");
            shutdownItem3.addEventListener(Event.SELECT, selectHandler);                
            shutdownMenu.addItem(shutdownItem3);

            // Add submenu to parent menu
            landingItem3.submenu = shutdownMenu;

            menu.addItem(landingItem3);
            return menu;
        }


        private function selectHandler(event:Event):void 
        {
            // Put code here to handle the selection
            Alert.show(event.target.label);
        }

        // Cleanup when we leave
        private function revertMenus():void {
            if (NativeApplication.supportsMenu) {
                NativeApplication.nativeApplication.menu = oldMenu;
            }
            if (NativeWindow.supportsMenu) {
                newWindow.close();
            }
        }
    ]]>
</fx:Script>
<s:VGroup horizontalCenter="0" top="10">
    <s:Label id="msg" width="100%" color="#FFFFFF" textAlign="center"/>
    <s:Button label="Show Menus" click="showMenus()"/>
    <s:Button label="Reset" click="revertMenus()"/>    
</s:VGroup>

And an screenshot

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:48:40+00:00Added an answer on June 2, 2026 at 6:48 pm

    I found a solution

     // Assign application menu (Mac OS X)
    
            if(NativeApplication.supportsMenu){
                var appMenu:NativeMenu = NativeApplication.nativeApplication.menu;
                while (appMenu.items.length > 1)
                {
                    appMenu.removeItemAt(appMenu.items.length - 1);
                }
    
                appMenu.addSubmenu(creerMenuFichier(),"Fichier");
                appMenu.addSubmenu(creerMenuEdition(),"Edition");
                appMenu.addSubmenu(creerMenuModule(),"Modules");
                appMenu.addSubmenu(creerMenuActions(),"Actions");
                appMenu.addSubmenu(creerMenuHelp(),"Aide");
    
                // Attach event listener routine to root menu
                appMenu.addEventListener(Event.SELECT, dispatchMenuCommand);
    
            }
    

    Instead of

                    NativeApplication.nativeApplication.menu = createMenu();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a Flex/Flash Builder 4 application that loads data using E4X/XML, like this:
I'm building an AIR application in Flash Builder and need to get something like
I'm developing a Adobe AIR application using Flash Builder 4. This app needs to
Work on this small test application to learn threading/locking. I have the following code,
I work on code something like this ... HEADERS ... int *var; void child()
In a very simple first AIR application (I'm using Flash Builder 4.5), I am
I am developing an AIR application. This application needs some hardware accesses that are
I am trying to do a basic tutorial like MXML Application on Flash Builder
Work on asp.net vs05. I have three type of value Like:IsDesign,IsPrinting,IsInstall they are bit
Work on the following website: http://cetcolor.com The masthead graphic with the Read About It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.