Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant create more the one listView #32

Open
verybluebot opened this issue Oct 3, 2019 · 1 comment
Open

Cant create more the one listView #32

verybluebot opened this issue Oct 3, 2019 · 1 comment

Comments

@verybluebot
Copy link

Failing in creating more then one listView

one is running over the other even though im assigning the instances to different
vars and even using different parents on listView constructor

    this.right = {};
    this.left = {};

    renderScroller (x, y, items, obj) {
        const bounds = new Phaser.Rectangle(
            x,
            y,
            500,
            600
        );

        const options = {
            direction: 'y',
            overflow: 100,
            padding: 50
        };

        obj = new ListView(this.game, this, bounds, options);

        obj.scroller.enable();

        obj.addMultiple(...items);

        obj.tweenToItem(0, 2);
    };

   const items = [
           this.game.add.image(0, 0, 'image-name'),
           this.game.add.image(0, 0, 'image-name')
     ];

    // Then calling the above render twice 
   this.renderScroller(100, 500, items, this.left);
   this.renderScroller(500, 500, items, this.right);

// 'this' is a class extending Phase.Group that contains this snippet 

any solution/ walk around??

Thanks

@verybluebot
Copy link
Author

Ok My bad, I was trying to use same images array as items for both list.. this messed things up apparently..

once I created a new item list for each ListView I was abled to render 2 instances.

Maybe this will help someone in the future, wasted a ridicules amount time on this :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant