Jump to content
GreenSock

charlie_says

TweenMax killDelayedCall 'bug'

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

I've hit an interesting problem using delayedCall/killDelayedCall

 

I've got a number of classes which, typically should run consecutively, but, can run concurrently. The classes are loading a video, and then when this fires its complete event, a delayedCall is used to activate the next part (usually loading an associated MP3). But, as the class/video can be skipped and should that happen I won't wont the next part to be activated, I use killDelayedCall to stop it.

 

What I've found is that not only will the delayed call be stopped from the first class, but from any other that are running that delayedCall.

 

I've not gone through the GSAP source, but, I expect that killDelayedCall is removing all references because it's using the name of the function rather than some unique reference.

 

So, is there a way to avoid this? (I have a fix, it's just a bit ugly.)

 

<edit> I just checked and I'm using v1.19 - not sure if upgrading to v1.2 would help? </edit>

 

Link to comment
Share on other sites

Its very tough to provide a solution without seeing a demo. 

 

Are you saying that doing something like

 

TweenLite.killDelayedCallsTo(ClassA.myFunction) 

 

is also killing delayedCalls to ClassB.myFunction or ClassC.myFunction?

 

killDelayedCallsTo() should only kill calls to the specific function you pass in.

 

if it is doing something else it would be great to see a very simple demo. We don't need to see videos or mp3s loading or anything fancy. Just some barebones code that shows killDelayedCallsTo() not working as expected. You could probably build the whole thing with 2 classes and a few console.log()s to show what is happening.

 

You can use CodePen (or any other online editor) as described here: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

 

 

Thanks.

 

 

 

Link to comment
Share on other sites

Hey @Carl that's exactly the issue.

 

I'm working in TypeScript which shouldn't really affect anything... But, I had thought that it wasn't expected behaviour.

 

I will try to knock up a demo tomorrow. 

 

 

Link to comment
Share on other sites

4 hours ago, charlie_says said:

I've not gone through the GSAP source, but, I expect that killDelayedCall is removing all references because it's using the name of the function rather than some unique reference

 

Hm. No, it doesn't use the name of the function - it uses the actual function object itself. But remember that if you're extending classes, they may all share the same reference to the same function, so perhaps that's the problem? I kinda doubt it's a GSAP issue but I could be wrong. A reduced test case would help (I know you're working on one). 

Link to comment
Share on other sites

hmm, made up a pen, and whilst it's a bit different, GSAP works exactly as you'd said (and I originally expected.)

 

I'll need to investigate the issue further - but, for now, it would appear not to be a GSAP issue.

  • Like 1
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.
×