Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
cipriancaba

Timeline of timelines

Recommended Posts

Hi,

 

I have a timeline that is made of timelines.

 

The subtimelines are created at a certain point but don't need to be used until later. Therefore, right after creating them, I call subtimeline.pause()

 

Now, later, when creating the supertimeline, i use appent multiple in order to add the subtimelines. And I also call supertimeline.play(). The problem is that the subtimelines are paused. So, i send them all a subtimeline.resume()

 

The problem is that this is causing a very big delay in the triggering of the onComplete event for the supertimeline and I don't really see why.

 

Is there another way instead of using pause() + resume() ? First I want to suppress the subtimeline, and when the "playhead" reaches it, to start playing it, just like a flash movieclip.

 

Cheers,

Ciprian

Link to comment
Share on other sites

Hello cipriancaba,

 

Thank you for so clearly explaining your issue. In order to better provide a solution can you explain why it is that your subtimelines need to be created prior to the supertimeline being created and played?

 

In a situation like this I would normally just recommend that you create or populate the subtimelines as soon as they are being placed in the supertimeline, this way there is no need to pause and resume and they will perform as expected.

 

import com.greensock.*;

//set up supertimeline with some stuff in it
var superTL:TimelineMax=new TimelineMax({paused:true});
superTL.append(TweenLite.to(b0, 1, {x:300}));


//create subtimelines for future use
var child1TL:TimelineMax = new TimelineMax();
var child2TL:TimelineMax = new TimelineMax();

stage.addEventListener(MouseEvent.CLICK, playTL);

function playTL(e:MouseEvent):void {

//populate first subtimeline
child1TL.append(TweenLite.to(b1, 1, {x:300}));
child1TL.append(TweenLite.to(b1, 1, {alpha:0}));

//populate second subtimeline
child2TL.append(TweenLite.to(b2, 1, {x:300}));
child2TL.append(TweenLite.to(b2, 1, {alpha:0}));

//append to supertimeline
superTL.appendMultiple([child1TL, child2TL], 0, TweenAlign.SEQUENCE);

//play supertimeline
superTL.play();
}

 

 

Perhaps there is a way to approach your situation with your current setup and reach your desired results.

If you just want to "have them coded prior to coding the supertimeline" you could create them in a function and just call that function prior to appending them to the supertimeline as well.

Again, it would help to know why they need to be created in advance.

 

Thanks

 

Carl

 

CS4 fla attached for reference (no greensock classes)

Link to comment
Share on other sites

oh, in addition, you could also create your subtimelines in advance, append them to the supertimeline right away (have the super paused) and then later on prepend() a whole bunch of stuff.

Link to comment
Share on other sites

hello carl :)

 

I am having a little problem understanding the default behaviour of a timeline.. the play() is automatically called after the timeline creation? is there a need to specifically call play() ? Or is the append method that automatically starts the timeline?

 

The reason why I need the creation of sub timelines prior to the creation of the super timeline is that I have lots of different(different aligns most of the time) sub timlines throughout the application and the easiest solution seemed to be this one.. also, i have different onComplete events for each of the subtimelines and I need another onComplete event(for each of the sub timelines) that does something completely different in the super timeline..

 

I will give it a go with the supertimeline paused solution..

 

thank you very much,

ciprian

Link to comment
Share on other sites

it's working with the supertimeline.pause solution

 

i solved the subtimeline completion detection by adding a callback at the supertimeline.duration everytime when i added a new subtimeline

 

thank you very much

Link to comment
Share on other sites

very glad you got it working!

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