Hi,

Do work with this problem, i extend the Menu class to control the y
position after the show function...
You can also direcly after you show function move the y position like
this:
                 var popMenu:Menu= Menu.createMenu(zoomBox, myMenuData,
false);
                 popMenu.labelField="@label"
                 popMenu.addEventListener("itemClick", menuViewHandler);

                 // Calculate position of Menu in Application's
coordinates.
                 point1.x=event.currentTarget.x;
                 point1.y=event.currentTarget.y;
                 point1=zoomBox.localToGlobal(point1);

                 popMenu.show(point1.x + 15, point1.y+24);
                 var shift:Number = popMenu.y + popMenu.height -
screen.height;
                 if (shift > 0){
                    popMenu.y = Math.max(popMenu.y - shift-24, 0);
                 }
...

package com.timeline.view
{
import mx.controls.Menu;
import flash.display.DisplayObjectContainer;
import mx.core.Application;


     public class MyMenu extends Menu
     {

         public var menuBarHeight:Number=25;

         override public function show(xShow:Object = null, yShow:Object
= null):void
         {
             super.show(xShow,yShow+menuBarHeight)
             var shift:Number = y + height - screen.height;
             if (shift > 0){
                y = Math.max(y - shift-menuBarHeight, 0);
             }
         }

          public static function
createMenu(parent:DisplayObjectContainer, mdp:Object,
showRoot:Boolean=true):MyMenu
         {
             var menu:MyMenu = new MyMenu();
             menu.tabEnabled = false;
             menu.owner =
DisplayObjectContainer(Application.application);
             menu.showRoot = showRoot;
             popUpMenu(menu, parent, mdp);
             return menu;
         }

     }
}


Or as i said with a custom class:

--- In flexcoders@yahoogroups.com, "kkinaru" <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot, Manish.
>
> >
> > If I'm not wrong, menu objects are directly parented by the system
> > manager. You can verify this by trace()'ing menu.parent. You want to
> > use that parent object with localToGlobal().
>
> In createMenu, first parameter is assigned to menu.parent property, I
> used null, so, ok, my menu.parent is System Manager for all (menu and
> submenus). But I've problems with submenus, because
> menu.parent.localToGlobal(event.menu.x, event.menu.y) returns (0, 0)
> for every submenus. (system_manager === menu.parent)
>
> I'm listening the onShow event, is this correct?
>
> It seems that the system buid the menus in the position 0,0 and then
> it moves them to their places.
> I'm loading data from an external XML and I'm saving main menu in a
> class variable and move it manually to its place, and it is the only
> menu that doesn't return (0,0) in localToGlobal...
>
> I'm a bit confused... any other ideas?
>
> Thankou all very much for these minutes.
>


Reply via email to