Jump to content
Search Community

Timelinelite onComplete is not exactly right...

Vicware test
Moderator Tag

Recommended Posts

I have just discovered that when you have this:

 

var TimelinP:TimelineLite = new TimelineLite({onComplete:panelFinish, onCompleteParams:[panelChoose, someMove, direx]}); // onComplete:gridZoomFinish, onCompleteParams:[toolCheck]});

TimelinP.insert(TweenLite.to(Laser_Array[panelChoose].getChildByName(vTmp), ratTime, {transformMatrix:{y:shiftMove, ease:Strong.easeOut}}));

 

for(var tlCnt:int = 1, tllen:int = tPCnt; tlCnt < tllen; tlCnt++) {

shiftMove = Laser_Array[panelChoose + tlCnt].y + someMove;

TimelinP.insert(TweenLite.to(Laser_Array[panelChoose + tlCnt], ratTime, {transformMatrix:{y:shiftMove, ease:Strong.easeOut}}));

}

TimelinP.play();

 

This works perfectly (its for an accordion display) but here's the problem - I expect this to go to panelFinish when

the entire thing is done playing, but it doesn't. It goes to panelFinish after the last TweenLite fires but BEFORE

that last tween is finished playing. Is this the behavior expected? Am I doing something wrong?

 

I know how I can get around this (have to have oncomplete's for every TimeLinP insert and check status), but it

kind of defeats, it seems to me, the usefullness of having an onComplete function for TimeLineLite that fires before

the whole thing is done.

 

Any ideas?

 

Thanks -

Vic

Link to comment
Share on other sites

I'm pretty sure that's incorrect, Vic. Could you post a very simple FLA that demonstrates this behavior and proves that the onComplete is firing too early? I'd be very interested in seeing that. I wonder if something else in your app is calling that method.

Link to comment
Share on other sites

Oh!? It was not expected that this is unexpected. I thought maybe you were going to

tell me that timelinelite is supposed to fire oncomplete when it finishes firing the last tween.

 

In that case, let me look at this and see if there's something I'm missing. I can assure you

that it is firing just at the last tween start, not when it's finished tweening. If you're saying

it's not supposed to fire until the last tween is finished running, maybe I got some duplicate

something going on.

 

You can look at http://www.coulterflow.com/bciflow/vic/IFG/ifg.html (proprietary) - Select an

instrument, and click "open all" button, then hit the "close all." You can see the "open all" button

re-enables itself when the last accordion panel STARTS, not when it is finished sliding. (That's

panelFinish being triggered to re-enable the button)

 

I'll get back to you shortly.

 

Thanks, Jack -

Vic

Link to comment
Share on other sites

I'm not seeing anything I might be doing wrong. The only thing is that the code I sent

you earlier takes place in a static function:

 

private static function gatherPanels(panelChoose:int, someMove:Number, direx:Boolean):void {

 

This probably has nothing to do with anything, but as you see in the code, TimelinP is created in this function.

I thought this might mean something so I'm just running it by you.

 

Vic

Link to comment
Share on other sites

The best way to attack this is to isolate just that code in a completely separate FLA and see if you can reproduce it there (with the absolute minimum amount of code). Keep adding to it until it breaks. That's a good technique for any troubleshooting.

 

Feel free to post a simplified FLA that demonstrates the issue.

 

And yes, the onComplete of the TimelineLite will not fire until all of its child tweens/timelines have FINISHED.

Link to comment
Share on other sites

Unfortunately I'm a week past my deadline with this project, and I just can't make

the time right now to re-create this problem in a simpler fla - I'm not exactly the

fastest writer of code in the world anyway - especially AS3. And I don't even know

if I can reproduce this, though I can see clearly in my script what's happening and know

it's firing before the last tween is finished. I'll work on something for you(us) when I can.

 

I'm going to try to insert a dummy delay tween at the end of the created timeline to

see if that helps me for now.

 

Thanks -

Vic

Link to comment
Share on other sites

I really don't know why it's firing prematurely in my code. I don't get it.

I've used TimelineLite with onComplete in several situations, and haven't ever noticed this before.

But it's clear as day. I don't know what's going on.

 

Vic

Link to comment
Share on other sites

I took the time to make a small fla that inserts a bunch of tweens in a for loop

and then appends an additional tween after the loop is done. I can not duplicate the

problem, as I suspected would be the result. But I'm doing the same thing in my script yet

it always fires the last onComplete before the last tween is done. So I don't know how to explain it.

 

I got around this by giving the last appended tween(after the loop loader), it's own onComplete,

which works fine and gives me the true trigger for when the whole timeline is complete. I

haven't seen any negative posts or docs regarding having onComplete's for both the timeline and an

individual tween loaded into the timeline. I'm actually using this in a couple other apps

which seem to work fine.

 

Thank you for your help today.

 

Vic

Link to comment
Share on other sites

Just a random thought: have you tried doing a trace() in there to see how often you're calling that method? I wonder if you're calling it multiple times over the course of several seconds and so when the first TimelineLite finishes, the second one isn't quite finished yet and you're seeing the onComplete fire (from the first one but thinking it's from the second). See what I mean? If you want to kill the old/previous TimelineLite, just call its kill() method.

Link to comment
Share on other sites

Jack -

 

They call me Vick Tracy - I use trace so much for debugging and development

because I do pure AS3 and I work in an external text editor. I spent days making

sure that code is working in an orderly fashion, and all the timing was correct. I

did some experimenting with kill(), which did not help my situation.

 

I do see what you mean. I checked that the order of the tweens were correct and everything

was working in the right order. Many times.

 

Actually, random thoughts were all I was looking for from the gitgo - I wasn't expecting

anyone to start debugging code for me. So I'm sorry if I got you upset yesterday. I was

just looking for something that maybe appeared before from other users.

 

I have it working now with my little kluge of a solution: http://www.coulterflow.com/bciflow/vic/IFG/ifg.html

 

I'm working on my new web site - not public yet: http://www.vicware.com/mainsite/vicware1.html

Most of the site and linked projects use your stuff.

 

Thank you -

Vic

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