Skip navigation
Currently Being Moderated

How to resize nativeWindow with aspect ratio?

Apr 8, 2012 11:59 AM

Tags: #air #as3 #flex #desktop #development #air3 #native #nativewindow

Is there any way to resize nativeWindow with aspect ratio (proportional) that works on Windows and Mac?

 

This solution by sydd works ok (tested on Windows) only for edges but not for corners:

http://stackoverflow.com/questions/5239691/air-resizing-native-window- proportionately

 

    private function windowResizeEventHandler(evt:NativeWindowBoundsEvent):void
   
{
        evt
.preventDefault()
       
if (evt.beforeBounds.width != evt.afterBounds.width){//user resizes width
            evt
.currentTarget.width = evt.afterBounds.width
            evt
.currentTarget.height = evt.afterBounds.width/ASPECT_RATIO;
       
} else if (evt.beforeBounds.height != evt.afterBounds.height){
            evt
.currentTarget.height = evt.afterBounds.height
            evt
.currentTarget.width = evt.afterBounds.height*ASPECT_RATIO;
       
}

   
}

 

When you resize from bottom right corner, you got flickering. Resizing from other corners is wrong.

How to solve this?

 

Is there an option to detect from which corner/edge resizing started? So I can manually set proper bounds.

 
Replies
  • Currently Being Moderated
    Jan 16, 2013 11:29 AM   in reply to nemi123

    It looks like there is.  Have you checked out nativeWindow, especially startResize()?

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/display/NativeWindow.html#startResize%28%29

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points