Hi,
I must apologize for my stupidity in the post on 06/19/2008
12:08:40 PM (as well as other incidents of my brain malfunction). I
made some statements that are not true. For instance I said: "Their
assumption was that video is the king and default for going full
screen is to resize video only." This is BS. They did not make this
assumption and, actually, programmers have a full controls over
display.
kglad, you prompted me to look deeper into hardware
acceleration and now I understand things better (or so I hope).
I do bypass hardware acceleration and all the resizing occurs
programmatically.
My understanding is that when one uses Rectangle to scale the
video - it will scale up everything that falls within the
boundaries of the rectangle. I could not find a way to scale just a
video using rectangle. I hoped that a line like the following will
work:
_video.stage.fullScreenSourceRect = screenRectangle;
_video.stage.displayState = StageDisplayState.FULL_SCREEN;
It did but in the same way as (note there is no _video in the
scope)
stage.fullScreenSourceRect = screenRectangle;
stage.displayState = StageDisplayState.FULL_SCREEN; - meaning
everything is scaling up.
I don't think I completely understand the concept of stage
yet because in my mind each DIsplay Object had it's own stage and
this stage didn't translate to the stage of a higher (parent)
display object. In reality, when I refer to stage - it pulls the
reference to the highest stage.
kglad, if you find time to clarify this - it would be an
enormous contribution to humanity :-)
Back to the description of how I coded full screen WITHOUT
utilizing hardware acceleration (in case anyone still trusts my
intellect :-):
Step 1. Create some mechanism that will react to the user's
wish to see the thing full screen.
It could be a button with a listener added. The listener will
toggle stage.displayState
Step 2. Create a mechanism that will react to displayState
change.
a. Get System.Capabilities.screenResolutionX and
screenResolutionY - these two parameters will tell you how wide and
high video possibly can be.
b. Calculate desired video dimensions based on the resolution
and video metaData width and height. This means that one of the
ratios will give you scaling factor. For instance:
var scaleFactor:Number =
Capabilities.screenResolutionY/metaData.info.height will define how
to scale it up (by setting _video.scaleY and scaleX = scaleFactor)
using this newly calculated scaling factor (assuming you want the
video fill entire screen).
c. Scale the video. Center it if desired.
d. Hide objects that you do not want to be visible in full
screen mode
e. Position visible objects in a desired way. For instance,
move player controls to the bottom of the screen calculating x and
y, again, using screenResolution parameters.
When user exits the full screen mode - reverse what was done:
resize the videos to its original dimensions, positions it to
original x and y, unhide other objects, move player controls where
they belong.
Done.
A brief look at the approach is to enter the full screen mode
without resizing the swf originally. If no further action taken -
your player will look as it originally looks: all the dimensions
preserved and swf is position where it is by default (left, center
or right). And then resize/reposition according to the specs.
Hope it helps.
Thank you kglad!