Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

How to resize nativeWindow with aspect ratio?

$
0
0

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

 

    privatefunction 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;
       
}elseif(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.


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>