Jump to content
Search Community

Timeline references

farmazone test
Moderator Tag

Recommended Posts

Hello,

 

I have animation: one page hides, then the other shows.

I stuck on something that I don't understand:

 

var tl:TimelineMax=new TimelineMax();

tl.append(currentPage.animateOut())

 

var tc:TweenCore=nextPage.animateIn();

tc.vars={onStart:adjustScrollBar}

tl.append(tc)

 

When this code runs the second time over the same page - I mean the page is shown again - adjustScrollBar is not invoked. Why? I know that I can pass additional parameters to animateIn function to complete this task but I think I miss something... something with TimelineMax references.

 

Thanks

Link to comment
Share on other sites

Tough to say without seeing the code in context. But the onStart should definitely get fired again every time the TimelineLite/Max goes from a currentTime of 0 to something greater than 0 (basically, whenever it starts).

 

Be very careful about this line:

tc.vars={onStart:adjustScrollBar}

because it completely overwrites the tween's/timeline's vars object which might store other significant stuff like an onComplete, etc. It would be safer to do this:

tc.vars.onStart = adjustScrollBar;

 

If you're still stuck, feel free to post a sample FLA that demonstrates the issue. Please keep it as simple as possible - no need to post your production file(s).

Link to comment
Share on other sites

Ok during the preparation of sample working code I found what was wrong. in animatOut / animateIn function I had TimelineMax.complete() and TimelineMax.clear(). I have replaced them with new TimelineMax() and now it works as it should. I wanted to clean up unfinished tweens.

 

Thank you for pointing me to a solution.

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