views:

1881

answers:

4

Hi, I am working on a Flash app that is 900x700 pixels. When viewed in misc. browsers at 1024x768, the browser chrome causes robs too much of the vertical space and the app appears in a window with a vertical scrollbar. Unacceptable.

The flash app will be launched via a link emailed to the viewers.

I'd like to avoid resizing the flash app and am wondering if there's a way to do the following via javascript, with no clicks involved:

  1. maximize the current browser window
  2. remove current window address bar and tabs / switch browser to full screen view (equivalent to pressing F11).

An alternative would be to resize the flash app vertically to match the browser canvas height to avoid scrolling. This may cause the app to become unreadable, so not the best approach in my case.

Thank you!

UPDATE: Seems that browser resizing and autoswitch to full screen won't work and neither will the flash app auto resize. What is the best approach then? And, some users may have browsers with toolbars or open a small browser window.

The only idea I have is to use javascript and display a message to users with small browser windows to pres F11 manually. The audience is executes and some may not even know what an F11 means...

+3  A: 

There is no way to maximize the browser window to full screen with JavaScript. While this is unfortunate for your genuine requirement, it is considered a security restriction.

Sources:

Daniel Vassallo
There is something close to it using moveTo 0 0 .. but its ugly .. +1
c0mrade
+1  A: 

You can use JavaScript to open a new window (using window.open) and control the window that is opened (no address bar, etc). You can also control the size of the window (you can't maximize it, but you can get the users screen size, and set the window that same size).

Gabriel McAdams
Browsers tend not to allow you to remove the address bar these days (and an anti-phishing measure)
David Dorward
+1  A: 

The window size can be altered by using:

window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);
Joel Alejandro
+1  A: 

To answer the question in the comment you made to your own post. Yes. You can have a button whose click handler does this

stage.displayState = StageDisplayState.FULL_SCREEN;
sberry2A
So, this would resize the stage to full screen? I am wondering then, would it be able to restrict the scaling of the application portion and resize a background to full screen while maintaining the intended size for the app? I guess I am asking to resize the background of the app but restrict the up-sizing of the active portion of the canvas.
aaandre
Yes, stage.scaleMode = StageScaleMode.NO_SCALE will maintain the size of the app. The rest of the screen would be filled with the background color of your app.
Lars