Flash Full screen in actionscript 2.0 ?
February 23rd, 2007 by
Jaap Kooiker
Well....did you see the question mark in the title?
Today I tried to get work the full screen option to work in actionscript 2.0. After a few minutes I had it working completely. I'm sorry did I say completely?
Getting the flash object full screen was peanuts, but then...
My original flash object isn't 4:3 resolution it is 960 - 700. And now the problems start to kick in. The full screen isn't centered! It just originating from 0,0. Ok maybe that's logical, the only problem is that I get a stupid bar on the bottom of the screen wich is the color of the background in the movie. And what about all the widescreen TFT screens that manly everybody else uses nowdays. They get a huge plain right sidebar. That sucks...I mean big time, I wan't to play a movie full screen, maintain the aspected ratio and center the flash object. Regardless what the screen resolution of the client is.
As I said, the first and the second are working.
The problem is that in fullscreen the Stage.height (and every other _width and _height properties) stays the same. I know this isn't weird but somewhat un-handy.
You can actually read the clients screen resolution by doing this:System.capabilities.screenResolutionX and System.capabilities.screenResolutionY but you can't use it because if you set the movieclips _width and _height to the previous properties you get unexpected results. It multiplies the scalefactor (wich is used to get it full screen) with the System.capabilities.screenResolutionX, that just makes it not usuable.
Normally to center a movieclip I do this (sample):
-
this.target_mc._x = (Stage.width / 2) - (this.target_mc._width / 2);
-
this.target_mc._y = (Stage.height / 2) - (this.target_mc._height / 2);
In the full-screen option I expect to do something like this:
-
this.target_mc._x = (System.capabilities.screenResolutionX / 2) - (this.target_mc._width / 2);
-
this.target_mc._y = (System.capabilities.screenResolutionY / 2) - (this.target_mc._height / 2);
As I told earlier this isn't working.
If only there was a way to read the calculated scalefactor.....
I know there is solution. I must recalculate the scalefactor flash uses,
but that is to much for a friday afternoon...:)
Jaap Kooiker
Posted in Actionscript 2.0, Flash 8 |