Jump to content
Search Community

LiquidStage problem

bruno.swf test
Moderator Tag

Recommended Posts

Hi,

 

I'm having some issues with LiquidStage.

I've got 'movie main' set up, in which I load both 'movie menu' and 'movie home'. Both of them have their respective LiquidStages defined.

When I resize 'main' everything goes well, but when I maximize the windows they don't get organized.

It seems that the LiquidStage resizing action is only dispatched when the window is manually resized.

 

Could somebody please help me on this?

 

Thanks.

Link to comment
Share on other sites

Nope, I just checked and LiquidStage seems to resize fine for me when I click the maximize button on the window. I wonder if there's something else going on in your code. Did you maybe set a maximum width/height that's keeping your swf stage from expanding all the way?

Link to comment
Share on other sites

Yes, I've been using LiquidStage for a while now.

This is the first time I'm having trouble with it. Just to emphasize, the resize event is correctly dispatched in the main movie. The dispatch problem occurs only in external movies. :?

 

Thanks.

Link to comment
Share on other sites

I made a simple example of what is happening.

The link is: http://tikiweb.com.br/bruno_teste/liquid_stage/

 

main.swf

import com.greensock.layout.LiquidStage;
import com.greensock.layout.LiquidArea;
import flash.display.MovieClip;
import com.greensock.layout.ScaleMode;
import com.greensock.loading.SWFLoader;
import flash.display.StageAlign;
import com.greensock.layout.AlignMode;
import flash.events.Event;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP;

var _ls:LiquidStage = new LiquidStage(this.stage, 1000, 590, 1000, 590, 99999999, 99999999);
var _la:LiquidArea = new LiquidArea(this, 0, 0, 1000, 590);

var _bg:MovieClip = mc_bg as MovieClip;
var _target_menu:MovieClip = mc_target_menu as MovieClip;

var _base:String = this.stage.loaderInfo.loaderURL.substr(0, this.stage.loaderInfo.loaderURL.indexOf("main.swf"));

_la.attach(_bg, ScaleMode.PROPORTIONAL_OUTSIDE);

var _load_menu:SWFLoader = new SWFLoader(_base + "menu.swf", {name:"menu", container:_target_menu});
_load_menu.load();

_ls.update();
_la.pinCorners(_ls.TOP_LEFT, _ls.BOTTOM_RIGHT);

 

menu.swf

import flash.display.MovieClip;
import com.greensock.layout.LiquidStage;
import com.greensock.layout.LiquidArea;
import com.greensock.layout.ScaleMode;
import flash.events.Event;

var _bg:MovieClip = mc_bg as MovieClip;

this.addEventListener(Event.ADDED_TO_STAGE, this_ADDED_TO_STAGE);

function this_ADDED_TO_STAGE (e:*):void
{
var _ls:LiquidStage = new LiquidStage(this.stage, 1000, 100, 1000, 100);
var _la:LiquidArea = new LiquidArea(this, 0, 0, 1000, 100);

_la.attach(_bg, ScaleMode.WIDTH_ONLY);

_ls.update();
_la.pinCorners(_ls.TOP_LEFT, _ls.BOTTOM_RIGHT);
}

 

As you can see, the _bg in "main" adjusts itself to the window when it gets maximized, but the _bg in "menu" doesn't.

Link to comment
Share on other sites

Please post the 2 FLAs so that I can publish and reproduce exactly what I'm seeing at the URL you mentioned.

 

Also, it looks like you're creating two different LiquidStage instances for the same stage - I'd recommend just creating one and then you can use the LiquidStage.getByStage() method to find an already-created instance by the stage, like:

 

var ls:LiquidStage = LiquidStage.getByStage(this.stage);

Link to comment
Share on other sites

I've used the code you mentioned, now everything is working fine.

The "menu", though, does not start with the proper width, which should be 100%.

I've solved that using the following code:

var w:Number = this.stage.stageWidth;
var x:Number = (1000 - this.stage.stageWidth) / 2;

var _ls:LiquidStage = LiquidStage.getByStage(this.stage);
var _la:LiquidArea = new LiquidArea(this, x, 0, w, 100);

_la.attach(_bg, ScaleMode.WIDTH_ONLY);

_ls.update();
_la.pinCorners(_ls.TOP_LEFT, _ls.BOTTOM_RIGHT);

 

By doing that, the menu width and X position are both correct. Is there an easier way to fix this?

Link to comment
Share on other sites

Looks like you just forgot to align your bg to the TOP of your LiquidArea. Whenever I run into problems, I find it useful to turn the preview property on in LiquidArea to see exactly where it is and how my stuff is aligning inside of it.

 

I've attached the fixed version.

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