Jump to content
Search Community

Liquidarea and video

bartpop test
Moderator Tag

Recommended Posts

I'm running into a problem that I think is a bug, but perhaps I'm missing something.


I'm trying to used LiquidArea to resize a video clip, but when I use "ScaleMode.PROPORTIONAL_OUTSIDE", my video is being stretched vertically out-of-proportion


My video clip is 960x500 (FLV format, encoded with square pixels).


Here's my LiquidStage code:


var ls:LiquidStage = new LiquidStage(this.stage, 960, 500, 960, 500);
var la:LiquidArea = new LiquidArea(this, 0, 0, 960, 500);
la.attach(_video, ScaleMode.PROPORTIONAL_OUTSIDE);

If I use ScaleMode.NONE, my video displays with the correct aspect ratio (but doesn't scale when the window is resized). If I use ScaleMode.PROPORTIONAL_OUTSIDE my video is being stretched vertically (960 x 610) out-of-proportion. I can't figure out why this would be stretched so I'm assuming that this is a bug? Does anyone know if FLV's cause a problem with LiquidStage?

Link to comment
Share on other sites

I suspect it's a problem with your _video object - can you post a super simple FLA that demonstrates the issue? I know that there are some problems with Adobe's Video object in terms of how it scales things and reports its width/height/scaleX/scaleY. Have you tried using LoaderMax for your FLV? It works around a lot of those issues.

Link to comment
Share on other sites

Unfortunately I'm using the Gaia framework so I can't easily post a simple example.


I traced my Video object metaData and the width and height were correctly reported as 960 x 500.


Next, I traced my Video object properties BEFORE and AFTER attaching to my LiquidArea object.


BEFORE LiquidArea

_video.width = 960

_video.height = 500

_video.scaleX = 3

_video.scaleY = 2.08333333335


AFTER LiquidArea

_video.width = 960

_video.height = 720

_video.scaleX = 3

_video.scaleY = 3


Any idea why the scaleX and scaleY wouldn't initially be 1? That would seem to be the intuitive value for an unscaled video.

Link to comment
Share on other sites

Looking at those numbers, it seems that AS3 wants to set the scaleX and scaleY based on a video sized at 320x240. Since my video doesn't follow the same proportions, the scaleX and scaleY are different values.


Looking at what LiquidArea ScaleMode.PROPORTIONAL_OUTSIDE is doing, it's adjusting the scale to fill the space, but making the scaleX and scaleY equal values, which throws off the aspect ratio.


Does anyone know of a way to make Gaia/LiquidArea and Video play nice together?

Link to comment
Share on other sites

I found a way to get this working, it just required a little research into the AS3 Video constructor. ;)


Apparently, the Video class constructor uses 320x240 as the default width and height when instantiated. You can use the actual dimensions of your video to implicitly set these values so that the scaleX and scaleY are correctly interpreted, which results in LiquidArea correctly scaling the object.



_video = new Video();



_video = new Video(960,500);


Hope that helps someone else!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...