Jump to content
Search Community

VideoLoader : Dynamically resize

Jakob Sternberg test
Moderator Tag

Recommended Posts

Hi making a little run through of the VideoLoader..sofar everything is great, the only problem is figuring out how to properly resize the videoarea

 

It seems from looking at the scaleMode argument that you set a value for the greensock AutoFitArea?

So i guess the right way is to somehow modify that instance?, but how do i get a reference to the AutoFitArea instance?

 

..or is it better/easier to disable scaleMode argument entirely, and do sizing and cropping in a custom AutoFitArea that wraps the video display object?

 

Thanks

Link to comment
Share on other sites

SWFLoaders, ImageLoaders, and VideoLoaders all place the loaded content inside a ContentDisplay object which is really just a juiced-up Sprite with some additional features to support scaleMode, bgColor, bgAlpha,  and more.

 

Read more about ContentDisplay ohjects: http://api.greensock.com/as/com/greensock/loading/display/ContentDisplay.html

 

Note the fitWidth and fitHeight properties. You can adjust those after content has been loaded and the original scaleMode will still be honored. Pretty sure this is what you are looking for.

 

The ContentDisplay object has features similar to AutoFitArea, but it doesn't use AutoFitArea at all. 

 

If you need more help let us know.

  • Like 1
Link to comment
Share on other sites

Ok thanks for the reply, i'll be sure to read up on ContentDisplay

 

I used last option and wrapped the container in AutoFitArea, it works out nicely!

 

Edit: I used the last approach since i want scaleMode/Aalign options also.

Didnt' and still don't know if they are available through DisplayObject, but i'll find out ^^

  • Like 1
Link to comment
Share on other sites

After looking a littlebit at ContentDisplay it's definately the answer i was looking for. Thanks for the pointer Carl

//Abstract

var video:VideoLoader = new VideoLoader("test.flv", {name:"myVideo",container:myPlayer,    bgColor:0x000000,autoPlay:true});

/*..Later..*/
video.content.scaleMode = "proportionalInside";

function onStageResize(e:Event){

  video.content.fitWidth = stage.stageWidth;
  video.content.fitHeight = stage.stageHeight;
}

Oh well..i got to play with AutoFitArea, which is also quite nice, but for this particular one i will use this solution instead.

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...