Jump to content
Search Community

Liquid Stage when using masked content

ryanhungate test
Moderator Tag

Recommended Posts

Hey there... (I am a club member) I have not used the liquid stage or the club greensock classes for long... but I have had a ton of trouble with resizing the stage while using masked content which is not viewable to the user... or the stage...

 

The basics of what I am having trouble with seem to fall under this rule:

 

I have a holder movieclip on the stage...

I am loading dynamic movieclips from a for loop inside the holder... usually from a DB.

It could be either horizontal, or vertical... doing a ( _MCY += mc.y + mc.height +10 )

I am using a mask to hide the clips outside the desired area...

 

When I resize the stage, my proportional resizing is all screwy... meaning instead of resizing only the "mask" area, the flashplayer will base the resize height and width WITH the unviewable masked content as well. That makes the movieclip so small it cant be seen.

 

Do you have any clue how to fix this? I generally can not use points, because there are so many things on the stage at once.

 

Thanks a bunch!!!

 

Ryan

Link to comment
Share on other sites

Okay, I just posted an update to AutoFitArea that adds a new "calculateVisible" parameter that should accommodate masked content pretty well. It's certainly a tricky dilemma to get around because of the way Flash reports bounds/widths/heights and it requires more processing, but the technique I implemented seems to get the job done. The extra processing only occurs for objects that have the "calculateVisible" flag set to true (it's false by default). Please take a peek and let me know if it works for you. The docs are updated too.

 

http://www.greensock.com/autofitarea/

 

Of course you can just log into your account at https://www.greensock.com/account/ to get all the latest Club goodies.

 

Enjoy :)

Link to comment
Share on other sites

Hey there... First I wantd to say thanks for getting back to me so quick I didn't even realize that you responded! I was sitting around waiting for a notification email or something before checking the forum again. :)

 

So, in regard to the autoFit stuff... cant get it to work but yet I only just tried messing around about 10 minutes ago. For some reason, I am not getting any result from the code, nor am I tracing the event.CHANGE function...

 

Am I missing something?


var ls:LiquidStage = new LiquidStage(this.stage, stage.stageWidth, stage.stageHeight, stage.stageWidth/2, stage.stageHeight /2);
var area:AutoFitArea = new AutoFitArea(this, 0, 0, stage.stageWidth, stage.stageHeight, 0xCC0000);
area.attach(site);
area.preview = false;

var area:AutoFitArea = AutoFitArea.createAround(bg_mc);			
area.addEventListener(Event.CHANGE, onAreaUpdate);

function onAreaUpdate(event:Event):void 
{			
trace("updated AutoFitArea");			
}

Link to comment
Share on other sites

No no, you need to use a LiquidArea instead of an AutoFitArea if you want it to automatically update when the stage resizes. LiquidArea simply extends AutoFitArea and adds that capability (and a few other things). You use it pretty much the same way, though. LiquidArea.createAround().

Link to comment
Share on other sites

Got it... well, seems that it is still not exactly doing what it is supposed to do... Is there any way you could send a really basic .fla that does this?

By the way, I appreciate what you are doing... it means a lot. This damn resize thing is driving me nuts!

Link to comment
Share on other sites

Just in case you haven't seen this post yet, I did want to mention that what seems to be causing the problem, is when using a scrolling text area... so I have tried to combat the problem by doing something like this:

 

initApp()...

sizeMyContentHolders()...

 

THEN load the text and create my scroll area calculations through a function like:

 

function addText():void

{

_area._txt.text = "A VERY LONG PARAGRAPH......";

_area._txt.height = _area._txt.textHeight;

///...scroll calculations here based on the height...

}

 

function removeText():void

{

_area._txt.text = ""; //nothing

_area._txt.height = _area._txt.textHeight;

}

 

///for resizing listeners... I will do something like this:

 

function resizeMe(event:Event):void

{

if(_area._txt.textHeight > _area.height)

{

removeText();

}

 

///then do my resizing math here...

 

addText();

 

}

 

It has allowed me to resize the content holders fairly well, but it is killing me to know that we have to do weird stuff like that to make a proper resize work... I would assume that you can also do a while(mc.numChildren >=1){mc.parent.removeChild(mc)}; THEN run the resize function THEN add the children back... obviously using an array of mc's... UGH.

 

:)

Link to comment
Share on other sites

  • 3 months later...

Hi Jack,

 

is there a way to remove the listener which calculates the visible area?

 

Hi have a movie which is calculated via that code

 

ls = new LiquidStage(Gaia.api.getPage("index").stage, 1920, 1078, 1024, 510);

area = LiquidArea.createAround(contentBox, ScaleMode.PROPORTIONAL_INSIDE, AlignMode.LEFT, AlignMode.TOP, false, 0x00000, 0, 0, 1920, 99999, true, true);

 

you can see the movie here http://netsh10091.web04.net-server.de/d ... /#/service it´s the one with the red border around.

The scaling is excact the way i wanted it to be, but when you now click on the button with the 30 degree icon and resize the stage again, the calculation depends on the new visible view and that i wanted to prevent. Is there anyway that you can do a first calculation of the view and than remove the calculation listener, so that everything scales with the first calculated dimensions, because i want so show also the cropped elements but without the calculation outside of the bounding area.

 

Regards

 

Peter

Link to comment
Share on other sites

Hi Jack,

 

one question again, is it not possible in any way to define a reference size where to whole area and all its children knows how to calculate?

For example you have base size of 1920 x 1078 and on this base size every movie use the percent amount of that object to know how to size up or down in it´s own proportional way and not the bounding box of some object?

Maybe you did it already and i don´t know how to use it :-)

 

Regards

 

Peter

Link to comment
Share on other sites

No, sorry, but I think that would really muddy up the API (it's already more complex than I'd like). Why not simply mask those objects (the clips in this case) so that it still crops to the visible area properly? Either mask it or try using a scrollRect.

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