         if (upping) {
             submenu.y -= (submenu.getExplicitOrMeasuredHeight() - DisplayObject(row).height);
         }
+        // if we've poped out of the boundaries, just snap it to the lower right corner
+        if (_fitting != null) {
+            if (submenu.x < _fitting.left) {
+                submenu.x = Math.max(
+                        _fitting.right - submenu.getExplicitOrMeasuredWidth(), _fitting.left);
+            }
+            if (submenu.y < _fitting.top) {
+                submenu.y = Math.max(
+                        _fitting.bottom - submenu.getExplicitOrMeasuredHeight(), _fitting.top);
+            }
+        }
     }
 
     // from List

        if (mx + getExplicitOrMeasuredWidth() > bounds.right) {
            mx -= getExplicitOrMeasuredWidth();
        }
        if (my + getExplicitOrMeasuredHeight() > bounds.bottom) {
            my -= getExplicitOrMeasuredHeight();
        }

        // finally move it to the correct position

 * ];
 *
 * See "Defining menu structure and data" in the Flex manual for the full list.
 */
public class CommandMenu extends Menu
{
    /**
