Jump to content
Search Community

liquidstage with liquidarea and pinpoint problem

copperjohn test
Moderator Tag

Recommended Posts

Hi,

 

Inside my swf I have set a liquidstage and a liquid area to make a bar at the bottom of the stage.

the bar stretches in scalemode WIDTH_ONLY.

 

Now I want to put an object inside that bar and i want it pinpointed to the BOTTOM_RIGHT point.

Here I get a strange behaviour:

 

1 - if the object is a textfield (dynamic) its distance from the pinpoint grows proportionally with the browser width

2- if I break a part the texfield so its a graphic it scales! (like the liquidarea)

 

if i put the object outside the bar everything works great but i don't want to...

 

please help.. here is my code..

 

/* the bar */
		var AktivoDock:Sprite = new Sprite();
		AktivoDock.graphics.beginFill(0x000000);
		AktivoDock.graphics.drawRect(0,0, 960, 30);
		AktivoDock.graphics.endFill();
		AktivoDock.alpha = 0.8;
		addChild(AktivoDock);


		var ls = stage.getChildAt(0)["myLiquidStage"]; // ok this is beacause I'm in GAIA
		var area:LiquidArea = new LiquidArea(this, 0,300,960,500);
		area.attach(AktivoDock, ScaleMode.WIDTH_ONLY, AlignMode.CENTER, AlignMode.BOTTOM);
		//area.preview = true;

                      // dock010 is my textfield
		dock010.x = 730;
		dock010.y = 7;
	       AktivoDock.addChild(dock010); // when i do this the textfiled distance from the pinpoint changes proportionali
		//addChild(dock010); // if i do this the texfield stays attached to the pinpoint


		ls.attach(dock010, ls.BOTTOM_RIGHT);




		TweenMax.to(area, 1.5, {y:0, delay:.7});

Link to comment
Share on other sites

Hi I have a new issue i Made a new liquid Area inside a Sprite (that is attached to another liquidArea on the stage) all items inside

that sprite scale themselves even if i punt ScaleMode.NONE why ?

 

Thanks

CopperJohn

 

AktivoDock.graphics.beginFill(0x000000);
		AktivoDock.graphics.drawRect(0,0, 960, 30);
		AktivoDock.graphics.endFill();
		AktivoDock.alpha = 0.9;
		addChild(AktivoDock);



		var ls = stage.getChildAt(0)["myLiquidStage"]; // just getting the liquidstage instance from GAIA
		var area:LiquidArea = new LiquidArea(this, 0,470,960,30, 0xFF3366);
		area.attach(AktivoDock, ScaleMode.WIDTH_ONLY, AlignMode.CENTER, AlignMode.BOTTOM);
		//area.preview = true;


		// nested liquid area
		var DockArea:LiquidArea = new LiquidArea(this.AktivoDock, 10,0,930,23, 0xFF6699);
		//DockArea.preview = true;


		AktivoDock.addChild(dock001);
		DockArea.attach(dock001, ScaleMode.NONE, AlignMode.LEFT, AlignMode.BOTTOM);


		AktivoDock.addChild(dock010);
		DockArea.attach(dock010, ScaleMode.NONE, AlignMode.RIGHT, AlignMode.BOTTOM);


                      // the clips dock001 and dock010 do scale!!!!!! why???

Link to comment
Share on other sites

The problem in the first scenario is that when you think about the way you're nesting things, it's a logical impossibility. Either the LiquidArea must update first (position and scale its objects according to your instructions) or the nested dock010 must update its position first. Either way, they'll conflict with each other. Let's say the LiquidArea goes first and centers AktivoDock according to the new stage size. Perfect. But then when its child dock010 updates its position to be pinned to the bottom right corner, it affects the height/width of its parent object which was just centered but now isn't anymore because of dock010's new position. If, however, dock010 repositions first it will only be in the correct position in relation to the lower right corner until the LiquidArea updates because it will move the parent object (to center it in this example) which consequently slides the child dock010 to a new position. See the problem? No matter which one updates first, it throws the other off. It's a logical impossibility.

 

The problem in your second scenario has to do with the fact that you're nesting things again in ways that affect each other. If the parent object has a ScaleMode of WIDTH_ONLY, that will of course affect all child object. You can't scale a parent object and not expect it to affect the children.

 

Or did I misunderstand something?

Link to comment
Share on other sites

Hi, and thanks.

 

What I'm trying to do is "a bar snap to the bottom of the screen and stretch horizontally to fill the width of the stage"

then I need to put things inside that bar somethings need to align left and other on the right... so can

you help me to understand how to do it with liquidstage or liquidArea ???

 

THANKS

Link to comment
Share on other sites

Sure. Just because things need to be "inside" that bar visually, don't confusing that with necessarily having to nest the DisplayObjects. Instead, you could just create a bar on its own (a LiquidArea with preview = true and previewColor set to whatever color you want the bar to be) and then either attach() objects to that bar with whatever alignment you want or create another LiquidArea on top of it (with preview = false) and put your stuff in there. Lots of options actually. And by default, LiquidAreas will automatically pin their corners to the TOP_LEFT and BOTTOM_RIGHT corner of the screen but if you want your bar to just stay at a certain size you can easily pin the corners manually using the pinCorner() method. The key in this case would be pinning the upper left corner of your LiquidArea to the lower left corner of the stage so that when the stage gets taller, it doesn't stretch the LiquidArea at all. For example:

 

var bar:LiquidArea = new LiquidArea(this, 0, 370, 550, 30, 0x000000);
bar.pinCorners(ls.BOTTOM_LEFT, ls.BOTTOM_RIGHT);
bar.alpha = 0.8;

bar.attach(dock010, ScaleMode.NONE, AlignMode.RIGHT, AlignMode.BOTTOM);
...attach other stuff...

 

Or another option would be to create that LiquidArea and then create custom PinPoints on that LiquidArea to which you can pin DisplayObjects. That's a bit more code but it should work just fine and allows you to maintain certain relative distances.

 

Does that help?

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