Jump to content

help with timeline config/onComplete


Recommended Posts

I'm setting up a Timeline and I'm doing something wrong. I want to do this:

                var oc = function () { playerMoving = false; };
                var timeline = scene.tweens.createTimeline({ onComplete: oc });

but this doesn't work (onComplete is null when inspecting in the debugger and doesn't trigger).

I see that createTimeline() accepts a config, uses TimelineBuilder.js, and  https://github.com/photonstorm/phaser/blob/06998276ec670ceac942f44d344cea8b8af98578/src/tweens/builders/TimelineBuilder.js#L132 seems to apply that config. Seems something like the above should work.

I was able to force my callback into the timeline like this:

                var oc = function () { playerMoving = false; };
                var timeline = scene.tweens.createTimeline();
                timeline.setCallback('onComplete', oc, [timeline], timeline);

but this is a hack, it can't be the right way.

I'm probably missing something really simple, can anybody point it out?


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...