2 Replies Latest reply on May 29, 2007 7:43 AM by Bayani Portier

    Handling menu event


      I am sending part of my application. when event.index==1 i want a new mxml application to be opened.

      for example if i have another changepassword.mxml file ,this should be opened and shown when menu event is clicked. I dont want to use viewstack to open another mxml.

      <?xml version="1.0"?>
      <!-- menus/EventListener.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      import mx.controls.Menu;
      import mx.events.MenuEvent;

      private function createAndShow():void {
      var myMenu:Menu = Menu.createMenu(null, myMenuData, false);

      myMenu.show(225, 10);

      private function itemClickInfo(event:MenuEvent):void {


      <!-- The XML-based menu data provider. -->
      <mx:XML id="myMenuData">
      <menuitem label="MenuItem A" >
      <menuitem label="SubMenuItem A-1" enabled="false"/>
      <menuitem label="SubMenuItem A-2"/>
      <menuitem label="MenuItem B" type="check" toggled="true"/>
      <menuitem label="MenuItem C" type="check" toggled="false"/>

      <mx:Button x="10" y="5"
      label="Open Menu"
      <!-- Text area to display the event information -->


      any solution is greatly appreciated.

      Thanks in advance.
        • 1. Re: Handling menu event
          You can use the navigateToUrl open a new Flex swf file. You would want to open it as a new window, assuming you want to preserve the application that you launch from.

          You seem to be thinking of mxml like web pages. That is really the wrong paradigm for Flex. A better design would be to make the changepassword panel visible
          when required.
          • 2. Re: Handling menu event
            Bayani Portier

            flex doesn't work that way. If something is as clustered in its views as a menu, then you must use the viewstack, rather than navigate to a new app entirely.

            The entire power of the architecture is to download, and then provide the user with an application like experience. You aren't dealing with lightweight HTML files.

            Here is a great article on a design approach. It uses Cairngorm as its architectural framework, but it kind of illustrates the approach JKohn99 and myself are talking about: