Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
ppdc

fullsize video-background // liquid stage

Recommended Posts

hi,

i have to make a flv play fullsize in the background of my site and can't seem to get it right, either it's fixed top left and doesn't resize or it resizes but won't align to the left border of the stage… here's how i tried:

 

		bgVideo = new Video(stage.stageWidth, stage.stageHeight);
		addChildAt(bgVideo, 0);
		var nc:NetConnection = new NetConnection();
		nc.connect(null);
		ns = new NetStream(nc);
		bgVideo.attachNetStream(ns);
		var listener:Object = new Object();
		listener.onMetaData = function(evt:Object):void {/*trace(evt);*/};
		ns.client = listener;
		ns.play("flv/videofile.flv");

		videoStage = new LiquidStage(this.stage, stage.stageWidth, stage.stageHeight);
		videoStage.attach(logo, videoStage.TOP_RIGHT);
//			videoStage.attach(bgVideo, videoStage.CENTER);
		var videoArea:LiquidArea = new LiquidArea(this, 0, 0, stage.stageWidth, stage.stageHeight);
		videoArea.attach(bgVideo, ScaleMode.PROPORTIONAL_OUTSIDE);

 

the commented line was my other attempt.

 

I don't know if it's relevant, I am also adding other objects (navigation etc.) to my videoStage.

 

I also tried setting the stage.scaleMode to NO_BORDER, in flash and in the html-code, nothing would do the trick.

 

Help is greatly appreciated

Peter

Link to comment
Share on other sites

I believe the problem is that you're using stage.stageWidth and stage.stageHeight for the baseWidth/baseHeight. You're supposed to use the width/height at which you built the original swf. LiquidStage basically keys everything off of those values, pins things where they're supposed to be, and THEN stretches to fill the screen and adjusts everything accordingly. So let's say, for example, you built your swf at 500x400 and you've got a background object that's exactly 500x400 (filling the original stage). Then let's say that swf runs full-browser in a browser that's 600x500. If you plug stage.stageWidth/stage.stageHeight in for the baseWidth/baseHeight, it will measure everything as though your original swf was built to 600x500 which means there will be a gap of 100 pixels on the right side and bottom of your background object (which you wanted to fill the whole background). See what I mean? The whole idea behind LiquidStage is that it allows you to position everything at the standard size and give them rules for how to stretch/move from there.

Link to comment
Share on other sites

Hi,

thank you for the quick reply, and yes, now I do see what you mean…

seems to work now except that it looks like it scales porportional inside instead of outside.

i set all the sizes to the original swf's sizes (1260x760 that is):

		 bgVideo = new Video(1260, 760);
		addChildAt(bgVideo, 0);
		var nc:NetConnection = new NetConnection();
		nc.connect(null);
		ns = new NetStream(nc);
		bgVideo.attachNetStream(ns);
		var listener:Object = new Object();
		listener.onMetaData = function(evt:Object):void {/*trace(evt);*/};
		ns.client = listener;
		ns.play("flv/cara_denon.flv");

		videoStage = new LiquidStage(this.stage, 1260, 760);
		videoStage.attach(logo, videoStage.TOP_RIGHT);
		var videoArea:LiquidArea = new LiquidArea(this, 0, 0, 1260,760);
		videoArea.attach(bgVideo, ScaleMode.PROPORTIONAL_OUTSIDE);
		videoStage.addEventListener(Event.RESIZE, onLiquidStageUpdate);

 

is there still something i'm missing?

 

thanks again.

peter

Link to comment
Share on other sites

Could you send me an example FLA that demonstrates the scaling issue? No need to include the GreenSock classes. And it doesn't need to be your production file(s) - just something simple that shows it happening.

Link to comment
Share on other sites

well sure. where shall i send it? info@greensock.com?

wouldn't want to post it publicly, not sure the customer would appreciate…

 

peter

Link to comment
Share on other sites

Sure, that address will work.

Link to comment
Share on other sites

did you have the chance to look over my code?

thanks.

 

ppdc

Link to comment
Share on other sites

Hmm, I don't seem to have received anything, but it's probably because my spam filter gobbled it up. Please PM me with your preferred e-mail address so I can whitelist it and then you can resend your e-mail/files.

Link to comment
Share on other sites

hm, yeah, the attachments might have helped that… i just pm'ed you my mail and will resend the files later.

 

thx

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