views:

28

answers:

1

Hi,

For the application that I am developing in AIR, I have removed the chrome through the app.xml. I am managing the features of minimizing, maximizing, close, resize and all other functions from within the application. I am facing a problem with resize feature. I have defined the grips for resizing and also I am able to display my custom cursor when mouse moves over it. The problem is that only the part of this cursor is visible which lies inside the boundary of the application rest of the cursor image is hidden.

For implementing the custom cursor, I do the following.

  1. Embed the cursor image.
    [Embed(source='/resources/images/resize_right.png')]
    public var resizeRight:Class;
  1. Add the event listener to the canvas that acts as a grip.
    rightResizeGrip.addEventListener(MouseEvent.MOUSE_OVER, function(e)
    {
      setResizeCursor(CURSOR_RIGHT);
    });
    rightResizeGrip.addEventListener(MouseEvent.MOUSE_OUT, function(e)
    {
      unsetResizeCursor();
    });
  1. In setResizeCursor
    private function setResizeCursor(type:String)
{
    var cursorClass;
    var xOffset;
    var yOffset;

    switch(type)
    {
        case CURSOR_RIGHT:
            cursorClass = resizeRight;
            xOffset = -14;
            yOffset = -10;
            break;
        case CURSOR_LEFT:
            cursorClass = resizeLeft;
            xOffset = 0;
            yOffset = -10;
            break;
        case CURSOR_RIGHT_TOP:
            cursorClass = resizeRightTop;
            xOffset = -20;
            yOffset = 0;
            break;
        case CURSOR_RIGHT_BOTTOM:
            cursorClass = resizeRightBottom;
            xOffset = -20;
            yOffset = -20;
            break;
        case CURSOR_BOTTOM:
            cursorClass = resizeBottom;
            xOffset = -10;
            yOffset = -14;
            break;
        case CURSOR_LEFT_BOTTOM:
            cursorClass = resizeLeftBottom;
            xOffset = 0;
            yOffset = -20;
            break;
        case CURSOR_LEFT_TOP:
            cursorClass = resizeleftTop;
            xOffset = 0;
            yOffset = 0;
            break;
    }

    if(cursorClass)
        CursorManager.setCursor(cursorClass, CursorManagerPriority.HIGH, xOffset, yOffset);
}

Is it possible to have the complete image of the cursor shown though it lies outside the application boundary?

A: 

I believe you can add few-pixels margin in your custom chrome from the top, left, right and the bottom of the system window borders.

P.S: Do not forget to remove it on window maximize.

Maxim Kachurovskiy
Hey Maxim.. That's a good idea :) I have googled a lot about giving margins to the windowedApplication but could not find any way. It would be of great help if you could pass on a link where I could learn how to add margins. Thanks!!
Goje87
If you are drawing custom window header and borders, you can e.g just draw left border them from `(5,5)` to `(5, height - 10)` instead of `(0, 0)` to `(0, height)`. The same for other borders.
Maxim Kachurovskiy