views:

2539

answers:

3

With previous versions of flash, entering the full screen mode increased the height and width of the stage to the dimensions of the screen. Now that hardware scaling has arrived, the height and width are set to the dimensions of the video (plus borders if the aspect ratio is different).

That's fine, unless you have controls placed over the video. Before, you could control their size; but now they're blown up by the same scale as the video, and pixellated horribly. Controls are ugly and subtitles are unreadable.

It's possible for the user to turn off hardware scaling, but all that achieves is to turn off anti-aliasing. The controls are still blown up to ugliness.

Is there a way to get the old scaling behaviour back?

A: 
stage.align     = StageAlign.TOP_LEFT; 
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResize);

function onStageResize(event:Event):void {
    //do whatever you want to re-position your controls and scale the video
    // here's an example
    myFLVPlayback.width = stage.stageWidth;
    myFLVPlayback.height = stage.stageHeight - controls.height;
    controls.y = stage.stageHeight - controls.height;
}

Or, and I'm not entirely sure about this, you might try to do some 9 slice scaling on the FLVPlayback, but I don't know if that'll work.

9-slice scaling tutorial: http://www.sephiroth.it/tutorials/flashPHP/scale9/

UltimateBrent
That doesn't work with the new scaling behaviour - once you're in full screen, stage.stageWidth and stage.stageHeight are set to the dimensions of the video, not the screen.
Simon
Well shit, sorry, I thought those would update. Your method is way more effort than you should've had to but into it. Hopefully they'll fix this with Flash 10.
UltimateBrent
+1  A: 

I've eventually found the answer to this. The problem is that the FLVPlayback component is now using the stage.fullScreenSourceRect property to enter a hardware-scaled full screen mode. When it does that, it stretches the rendered area given by stage.fullScreenSourceRect to fill the screen, rather than increasing the size of the stage or any components.

To stop it, you have to create a subclass of FLVPlayback that uses a subclass of UIManager, and override the function that's setting stage.fullScreenSourceRect. On the down side, you lose hardware scaling; but on the up side, your player doesn't look like it's been drawn by a three-year-old in crayons.

CustomFLVPlayback.as:

import fl.video.*;
use namespace flvplayback_internal;

public class CustomFLVPlayback
{
    public function CustomFLVPlayback()
    {
        super();
        uiMgr = new CustomUIManager(this);
    }
}

CustomUIManager.as:

import fl.video.*;
import flash.display.StageDisplayState;

public class CustomUIManager
{
    public function CustomUIManager(vc:FLVPlayback)
    {
        super(vc);
    }

    public override function enterFullScreenDisplayState():void
    {
        if (!_fullScreen && _vc.stage != null)
        {
            try
            {
                 _vc.stage.displayState = StageDisplayState.FULL_SCREEN;
            } catch (se:SecurityError) {
            }
        }
    }
}

We add the FLVPlayback to our movie using actionscript, so we just have to replace

var myFLVPLayback:FLVPlayback = new FLVPlayback();

with

var myFLVPLayback:CustomFLVPlayback = new CustomFLVPlayback();

I don't know whether there's a way to make the custom class available in the component library.

Simon
+1  A: 

Here's another way to solve it, which is simpler and it seems to work quite well for me.

myFLVPlayback.fullScreenTakeOver = false;

The fullScreenTakeOver property was introduced in Flash Player 9 update 3. The docs are all a bit vague, but there's a bit more info here:

Using the FLVPlayback component with Flash Player 9 Update 3

aaaidan
That setting is a good start; though if you use it you have to do the rest of the layout yourself; it won't stretch the player to fill the screen.
Simon