Jump to content
Search Community

TimelineLite in a for loop?

junky test
Moderator Tag

Recommended Posts

Say I have a banner rotator that builds each banner based on an XML file that is looped though. Each banner has different text, images, etc. Could I also create a for loop that creates a timelinelite of the banner building in? And each time the banner is brought to the top of the rotator the timelinelite would be told to gotoAndPlay(1)?

 

I know I can loop, but how would I go about calling the timeline? Can I give it a name? and say timeline("number1").gotoAndPlay(1)?

 

I'm lost. Help!

Link to comment
Share on other sites

You could approach this a few ways.

 

you could have a master timeline that contains timelines for each banner.

 

once all the child timelines are built you could append them to the master with labels:

 

var main:TimelineMax = new TimelineMax();

var banner1:TimelineMax = new TimelineMax();
banner1.append(tweens)
banner1.append(moreTweens)

var banner2:TimelineMax = new TimelineMax();
banner2.append(tweens)
banner2.append(moreTweens)
...

//add banner timelines to main with labels

main.addLabel("banner1Start");
main.append(banner1);

main.addLabel("banner2Start", main.duration);
main.append(banner2)

//to control the main timeline 
main.gotoAndPlay("banner2Start");

 

----------------

 

the above is pseudo-code to illustrate a basic approach.

 

What you are describing would work really well with this OOP approach:

http://www.snorkl.tv/2011/05/real-world ... ase-study/

 

Or for something a little different:

http://www.snorkl.tv/2011/03/teaser-bul ... ansitions/

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