phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Adding a quad to a container throws setAlpha error

Open pfdtravalmatic opened this issue 7 years ago • 1 comments

Version

  • Phaser Version: 3.16.1
  • Operating system: Windows 10 Pro
  • Browser: Tested on Chrome and Firefox

Description

Adding a quad to a container throws an error: "Uncaught TypeError: child.setAlpha is not a function"

Seems to be caused by parent setting child object alpha during render update using setAlpha() (deprecated for this version).

Uncommenting final line should demonstrate error.

Example Test Code

      var config = {
        type: Phaser.WEBGL,
        width: 800,
        height: 600,
        backgroundColor: '#2d2d2d',
        parent: 'quad container error',
        scene: {
            preload: preload,
            create: create
        }
    };

    var game = new Phaser.Game(config);

    function preload() {
        this.load.image('image1', 'https://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg');
        this.load.image('image2', 'https://upload.wikimedia.org/wikipedia/commons/d/db/Patern_test.jpg');
    }

    function create() {

        var container = this.add.container(400, 300);

        quad1 = this.add.image(400, 300, 'image1');
        quad2 = this.add.quad(400, 300, 'image2');

        container.add(quad1);
        //container.add(quad2);
    }

Additional Information

pfdtravalmatic avatar Feb 01 '19 14:02 pfdtravalmatic

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

photonstorm avatar Feb 07 '19 00:02 photonstorm