Flash Full screen in actionscript 2.0 (followup)
March 12th, 2007 by
Jaap Kooiker
Today I decided to pick up where I left with AS 2 full screen and yes the questionmark I placed last time is gone....
I've seen full screen in AS 3, and that's simple, but it is not that simple (it is simple tough) . This time I cleared my mind and started to think from scratch. This time it took no time to figure out what to do to make it work(for the people that didn't read my previous post, I had a problem with the alignment of flash full screen in AS 2).
Th solution seems quite simple, namely this:
-
this.iViewScaleFactor = ((System.capabilities.screenResolutionX - this._width) <(System.capabilities.screenResolutionY - this._height))?
-
(System.capabilities.screenResolutionX / this._width):
-
(System.capabilities.screenResolutionY / this._height);
-
-
var iOffsetY = (System.capabilities.screenResolutionY - (this._height * this.iViewScaleFactor)) / 2;
-
var iOffsetX = (System.capabilities.screenResolutionX - (this._width * this.iViewScaleFactor)) / 2;
-
-
this._y = iOffsetY / this.iViewScaleFactor;
-
this._x = iOffsetX / this.iViewScaleFactor;
'this' is the video wich is now aligned in the middle of the screen whatever size the screen is. The only problem now is that the rest of the flashobject is showing in the background. I simply placed a black background view on stage with the stage dimensions.
I also placed a logo on the top right of the screen. To avoid the logo from rescaling (and look crappy) just divide the logo's _xscale and yscale with the scalefactor calculated earlier, like so:
-
this.logo_mc._xscale = this.logo_mc._yscale /= this.iViewScaleFactor;
Done!
Jaap Kooiker
Posted in Actionscript 2.0, Flash 8 |