Thankyou all... I have a solution:

Sadly, Menu implementation "controls" menu-out-of-bounds, with the
code posted upper:

from mx.controls.Menu.show(... , ...)
[CODE]
    // Adjust for menus that extend out of bounds
    if (this != getRootMenu())
    {
        var shift:Number = x + width - screen.width;
        if (shift > 0)
            x = Math.max(x - shift, 0);
    }

[/CODE]

As you can see, This piece of code can only control the right edge of
the screen... so it can result useless.

Thanks to you, now, I use onShow event and callLater to play a custom
animation.

Here is my code:

[CODE]
//this function is called in the eventListener(onShow)
private function processAfter(event: MenuEvent): void {
    //root menu is an exception in my schema.
    if (event.menu.parentMenu != null){
        var current_menu: Menu = event.menu;
        var menu_height: int = current_menu.height;
        var menu_width: int = current_menu.width;

        /*system execute the show function before the menu can be in
its correct place, I use these two lines to avoid menu can be
visualized (perhaps, it is not necessary) */
        current_menu.height = 0;
        current_menu.width = 0;
        this.callLater(this.moveSubmenu, [current_menu, menu_height,
menu_width]);
    }
}
/*******************************************************************/

private function moveSubmenu(current_menu: Menu, menu_height: int,
menu_width: int): void {
    var bottom_edge_menu: int = this.rootMenu.y+this.rootMenu.height;
    var submenu_edge: int = current_menu.y + menu_height;
    var pixels_upper: int = 0;

    if (limite_inferior_menu < limite_menu) {
        pixels_upper= (submenu_edge - bottom_edge_menu);
    }

    /*restoring menu height and width*/
    current_menu.height = menu_height;
    current_menu.width = menu_width;

    var animate_menu: Sequence = new Sequence();
    /* here comes animation sequence creation, using pixels_upper to
move up current_menu.y position*/

    animate_menu.play([current_menu]);
}

[/CODE]


I will continue looking for new solutions for this problem.

Thankyou very much for this help.


J Pablo


Reply via email to