1 Attachment(s)
Flash fullscreen w/ hardware scaling (a memo)
I'm posting this because I couldn't find any post on the web that said the whole story, from a user (developer) point of view. I will through it as a short FAQ:
Q: IS FULLSCREEN RESTRICTED TO EMBEDDED MEDIA (opened through a browser)?
A: No, fullscreen view in the standalone player has been available a long time before (I started developing Flash media since version 4, and it was there already, through fscommand) the new fullscreen mode. Today (with Flash Player 9.0.115), you can achieve fullscreen mode in standalone media the same you would in a browser.
Q: HOW DO I GO FULLSCREEN?
A: Well, first of all there is a limitation: only a user-started action will cause the fullscreen mode to work (this means that the code must be executed by an event handler, or event method). On the other hand, keyboard inputs will be ignored while in fullscreen mode (I yet have to verify if this restriction is now applied to standalone fullscreen too). The code is slightly different, depending on what language you are using (AS2 or AS3).
Q: HOW DO I GO FULLSCREEN ON AS2?
A:
Code:
myButton.onRelease = function() {
Stage["displayState"] = "fullscreen";
};
Q: HOW DO I GO FULLSCREEN ON AS3?
A:
Code:
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
function myHandler(event:MouseEvent):void
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
myButton.addEventListener(MouseEvent.RELEASE, myHandler);
Q: WHAT ABOUT THE HARDWARE SCALING STUFF?
A: Since the latest version of the Flash Player (9.0.115), a new *fantastic* feature has been included: hardware acceleration for the fullscreen mode. It is a really, really cool thing, because instead of actually changing the display mode of your computer screen (like videogames do, for example), it renders the content to be displayer at the resolution YOU want, and then passes it to the operating system, for a hardware-accelerated filtered scaling to the display size. This means that if you run a WUXGA (1920x1200) screen, like I do on my laptop, your display will always be running at it's full resolution, but the content displayed will be at your original resolution (within Flash). This cuts completely the awful bottle-neck of rendering the Flash content at full resolution, which made fullscreen mode impractical until now.
Q: IS HARDWARE SCALING RESTRICTED TO EMBEDDED MEDIA?
A: No, you can achieve fullscreen mode with hardware accelerated scaling in standalone media too, as well as projectors (as long as they are produced in an updated environment, that means that the originating SWF file must have been compiled through an updated playerglobal.swc, and that the projector must be created through the latest Flash Player - 9.0.115).
Q: HOW DO I GO HARDWARE ACCELERATED IN AS2?
A:
Code:
myButton.onRelease = function() {
import flash.geom.Rectangle;
Stage["fullScreenSourceRect"] = new Rectangle(0, 0, 640, 480);
Stage["displayState"] = "fullscreen";
};
Q: HOW DO I GO HARDWARE ACCELERATED IN AS3?
A:
Code:
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import flash.geom.Rectangle;
function myHandler(event:MouseEvent):void
{
stage.fullScreenSourceRect = new Rectangle(0, 0, 640, 480);
stage.displayState = StageDisplayState.FULL_SCREEN;
}
myButton.addEventListener(MouseEvent.RELEASE, myHandler);
Q: WHY CAN'T I MANAGE TO MAKE THIS WORK?
A: There are a few things you might need to troubleshoot. First of all, you need an updated version of the playerglobal.swc file (that will enable for the fullScreenSourceRect property to be interpreted), that I have attached here for your convenience.
The playerglobal.swc file (that I had to rename playerglobal.swc.txt to attach it here), must be replaced in the following locations:
For FLASH CS3:
*flash cs3 dir*/en/Configuration/ActionScript 3.0/Classes/
For FLEX 2:
*flex 2 dir*/Flex SDK 2/frameworks/libs/
For FLEX 3:
*flex 3 dir*/sdks/2.0.1/frameworks/libs/
Another thing I've noticed is that the Stage.scaleMode property conflicts with Stage.fullScreenSourceRect. So basically, if you are running a noScale movie, you will need to change that before going in fullscreen, and then going back when exiting fullscreen.
That is all folks, at least of what I can think of.
I hope this can be useful to someone!
I would have saved a few hours of research myself.......