Jump to content

Passing an Array into nested onComplete


Recommended Posts

The problem that I am dealing with is passing Pipets into the 2nd onComplete. It returns an undefined even though I try to declare it a global variable. In most case, only the last value of the array get pass in instead of 1-9. I am terrible at javascript and pixijs so please point it out since I've spent so many hours trying to figure this out.

for (var i = 0; i < 9; i++) {    if (i !== 7) {        Pipets = [];        Pipets[i] = new Pipette();        Pipets[i].x = 273 + 80 * i;        Pipets[i].y = -320;        TweenMax.to(Pipets[i], 1.5, {            y: 145, ease: Sine.easeInOut, onComplete: function (index) {                var tube = tubeArray[index];                TweenMax.to(tube.broth, 1, {                    y: tube.broth.y - 30, ease: Sine.easeInOut, onComplete: function () {                        TweenMax.to(Pipets[i], 1.5, {                                y: -350, ease: Sine.easeInOut                            });}                });            }, onCompleteParams: [i]        });        stage.addChild(Pipets[i]);    }}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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