Jump to content
Search Community

Tyring to achieve full AutoFitArea

LynnB test
Moderator Tag

Recommended Posts

I designed a 1200x600 swf that fills the browser window (100%x100%) and saw that on resolution of 1024x768 that the whole swf doesn't show (the bottom half is not visible). So I'm at my wits ends.

Now, I'm trying to use AutoFitArea and put all my display objects on it and to scale the swf up and down on resize so the whole swf shows in any browser but it's not working. I need the AutoFitArea to fill the whole browser window and it's not happening. The height fills the browser window but the width doesn't. And I don't know why! What's the problem?

Here is test code:

 

import com.greensock.layout.*;

import flash.display.StageAlign;

 

this.stage.align = StageAlign.TOP_LEFT;

 

var area:AutoFitArea = new AutoFitArea(this, 0, 0, 1200, 600);

area.preview = true;

 

area.attach(mc,ScaleMode.NONE, AlignMode.CENTER, AlignMode.CENTER);

area.attach(bar, ScaleMode.WIDTH_ONLY, AlignMode.LEFT, AlignMode.BOTTOM);

 

 

area.addEventListener(Event.CHANGE, onAreaUpdate);

 

function onAreaUpdate(event:Event):void {

 

trace("updated AutoFitArea");

}

Link to comment
Share on other sites

Your swf worked fine for me - maybe you've just got an issue with your HTML embed code? You didn't post it, so I'm not sure.

 

Keep in mind that making the swf go 100% width/height in the browser doesn't STRETCH all the contents disproportionally to fit the window. For example, drop a rectangle on the stage that exactly fits your stage (1200x600) and you'll see that it doesn't suddenly stretch and contort the proportions to fill the browser. You need to insert your own code to make the necessary adjustments. It will just scale the stageWidth and stageHeight, that's all.

 

For what it's worth, LiquidArea does this for you (it's a membership benefit of Club GreenSock "Shockingly Green" and corporate levels). http://www.greensock.com/liquidstage/

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