[flexcoders] Browser window size

2008-01-08 Thread byte.sensei
This is probably a simple question but is there an easy way to get 
the current browser window size? 

I have a Flex app with the application height/width set to 100%, and 
then I divide that up into various vbox/hbox elements.  However, in 
some instances I create a pop-up with PopUpManager.  The problem I'm 
having is that the pop-up might end up being too tall for the browser 
window size, and it ends up going off the screen without any way to 
scroll.  There's a vertical scrollbar on the main screen, but since 
it's behind the pop-up there's no way to use it.

In other words, the application height may be larger than the browser 
window height (which just engages a vertical scroll bar) but the pop-
up *thinks* it can use up to the application height when in reality I 
want to limit it to the (current) browser window height.

For now, I've set a maximum height of 400 pixels (which I know will 
fit on an 800x600 screen) but when the user has a higher resolution I 
want to be able to make the pop-up height larger than 400.

Ultimately what I want to do is create a VBox pop-up and then on 
creationComplete check its height against the current browser window 
height, and if it's larger, reset the height (which turns on the 
vertical scroll bar) but otherwise leave the height alone (no 
vertical scroll bar).





Re: [flexcoders] Browser window size

2008-01-08 Thread Jehanzeb Musani
Hello,

You can use the flash.system.Capabilities class to
find out the screen resultion of user system. For
browser info, you can write a function in JavaScript
and call it from flex using ExternalAPI interface. You
can find an exmple of that if Flex Help, search for
CapabilitiesGrabber in help.

Hope this helps.

Regards,
Jehanzeb

--- byte.sensei [EMAIL PROTECTED] wrote:

 This is probably a simple question but is there an
 easy way to get 
 the current browser window size? 
 
 I have a Flex app with the application height/width
 set to 100%, and 
 then I divide that up into various vbox/hbox
 elements.  However, in 
 some instances I create a pop-up with PopUpManager. 
 The problem I'm 
 having is that the pop-up might end up being too
 tall for the browser 
 window size, and it ends up going off the screen
 without any way to 
 scroll.  There's a vertical scrollbar on the main
 screen, but since 
 it's behind the pop-up there's no way to use it.
 
 In other words, the application height may be larger
 than the browser 
 window height (which just engages a vertical scroll
 bar) but the pop-
 up *thinks* it can use up to the application height
 when in reality I 
 want to limit it to the (current) browser window
 height.
 
 For now, I've set a maximum height of 400 pixels
 (which I know will 
 fit on an 800x600 screen) but when the user has a
 higher resolution I 
 want to be able to make the pop-up height larger
 than 400.
 
 Ultimately what I want to do is create a VBox pop-up
 and then on 
 creationComplete check its height against the
 current browser window 
 height, and if it's larger, reset the height (which
 turns on the 
 vertical scroll bar) but otherwise leave the height
 alone (no 
 vertical scroll bar).
 
 
 
 



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



RE: [flexcoders] Browser window size

2008-01-08 Thread Jim Hayes
Does this do what you want (using screenManager.screen) ?
 
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute 
  backgroundGradientAlphas=[1.0, 1.0]
backgroundGradientColors=[#943C3C, #943C3C] height=100%
width=100%
  mx:Script
![CDATA[ 
  private function traceIt():void
  {
var screenRect:Rectangle = systemManager.screen;
trace (ScreenTop :  + screenRect.top );
trace (ScreenBottom :  + screenRect.bottom);
trace (ScreenHeight :  + screenRect.height);
  }
]]
  /mx:Script
  
  mx:Button x=27 y=22 label=Button click=traceIt()/
  
/mx:Application
 
 
-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of byte.sensei
Sent: 08 January 2008 14:45
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Browser window size
 
This is probably a simple question but is there an easy way to get 
the current browser window size? 

I have a Flex app with the application height/width set to 100%, and 
then I divide that up into various vbox/hbox elements. However, in 
some instances I create a pop-up with PopUpManager. The problem I'm 
having is that the pop-up might end up being too tall for the browser 
window size, and it ends up going off the screen without any way to 
scroll. There's a vertical scrollbar on the main screen, but since 
it's behind the pop-up there's no way to use it.

In other words, the application height may be larger than the browser 
window height (which just engages a vertical scroll bar) but the pop-
up *thinks* it can use up to the application height when in reality I 
want to limit it to the (current) browser window height.

For now, I've set a maximum height of 400 pixels (which I know will 
fit on an 800x600 screen) but when the user has a higher resolution I 
want to be able to make the pop-up height larger than 400.

Ultimately what I want to do is create a VBox pop-up and then on 
creationComplete check its height against the current browser window 
height, and if it's larger, reset the height (which turns on the 
vertical scroll bar) but otherwise leave the height alone (no 
vertical scroll bar).
 

__
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
__