'윈도우 위치설정'에 해당되는 글 1건

  1. 2008.11.08 윈도우 위치 설정하기

윈도우의 상태 즉 모니터상에서 위치나 크기 등 메인 어플리케이션은 WindowedApplication속성이나 디스크립터 또는 <mx:Script>에서 nativeWindow로 접근하여 사용한다.
보통 크기는 width , height 위치는 x , y 등으로 설정되므로 .xml에서 찾아보면 쉽게 발견 할 수 있다.

메인에서 생성된 서브윈도우(NativeWindow)의 위치나 크기 설정도 앞서 투명창 설정한 바와 같이 Delgator에 바로 속성을 설정할 수 있다.
window.width = 300
window.height = 200
window.x = 300
window.y = 400


참고로 이벤트에 의하여 객체를 받아(event.target) Delegator를 처리할때는
아래처럼 stage로 접근하여 붙어있는 nativewindow로 접근한다.
event.target.stage.nativeWindow.x = 0;
event.target.stage.nativeWindow.y = 0;

사용자 모니터의 해상도를 읽어와 항상 가운데에 위치하도록 하기 위해서는 flash.system.Capabilities를 사용한다.

모니터 중앙에 위치
window.x = ( Capabilities.screenResolutionX - width ) / 2;
window.y = ( Capabilities.screenResolutionY - height ) / 2;  

참고로 screenResolutionX는 사용자 모니터의 가로 해상도이며 screenResolutionY는 세로 해상도이다.
Posted by 버터백통