Jump to content
GreenSock

Tamara

Dynamic Props with scrollRect

Recommended Posts

Hello!

 

It is the first time I am using the scrollRect property. It works really good! I am trying to scroll a whole container and on resizing of the stage, the scrollrect should get bigger/smaller. I have tried to use it in combination with dynamic props but this doesn't seem to work. Is that correct?

 

TweenMax.to(_container, t, {dynamicProps:{scrollRect:getScrollRect}, ease:Linear.easeNone});

Link to comment
Share on other sites

No, dynamicProps methods must return numeric values - a scrollRect is a Rectangle.

 

I'm not completely clear on what you're trying to do, but you could probably just use an onUpdate to run your custom code and make whatever adjustments you need on your scrollRect.

Link to comment
Share on other sites

Hi, thanks for the replay. I just adjusted the code to use an onUpdate function and works. Thanks!

 

What I wanted to do is to scroll up the whole "stage" but on resizing I couldn't update the width+height of the scrolling container to the new width and height (the new stagewidth)

 

So my code tweens the maxPosY number and the onUpdate sets the scrollRect

 

TweenMax.to(this, t, {maxPosY:-_backgroundManager.height, ease:Linear.easeNone,onUpdate:setScrollRect});

private function setScrollRect():void
	{
		_scrollRect.bottom=stage.stageHeight;
		_scrollRect.top=maxPosY;
		_scrollRect.right=stage.stageWidth;
		_scrollRect.left=0;

		_container.scrollRect = _scrollRect;
	}

 

Again, Thanks!

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