Jump to content

BitmapData.drawGroup : Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signatu


bali33
 Share

Recommended Posts

Hello,

 

I'm trying to draw a group into a BitmapData it fails - Here the code flloawed byt the console output :

var bmd = game.add.bitmapData(game.width, game.height);bmd.addToWorld();bmd.drawGroup(root);
Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signature provided.phaser.js:36430 c.BitmapData.copyphaser.js:22231 c.Group.iteratephaser.js:22016 c.Group.forEachExistsphaser.js:36500 c.BitmapData.drawGroup

Any idea why it failed ?

 

Thank you

Link to comment
Share on other sites

Hi,

 

Root is a Group - The variable is declare at the top of my script - the game variable is declare at the same place.

var game ; var root;window.onload = function() {    game = new Phaser.Game(800, 800, Phaser.AUTO, 'francetv-game', { init:init, preload: preload, create: create });    function init(){        console.log("Init game");      }    function preload(){        game.load.atlas('animations', 'assets/animations.png', 'assets/animations.json');        game.load.atlasXML('levelAssets', 'assets/levelAssets.png', 'assets/levelAssets.xml');      }    function create(){        game.stage.backgroundColor = 0xFF0000;        //Detect local        var locale = document.documentElement.lang;        if(locale != "fr" && locale != "de")            locale = "fr";        //Load dico XML        var dicoXML = loadXMLString("assets/dico_" + locale + ".xml");        //Create Dico class instance        var dico = new Dico();        dico.parseXML(dicoXML);        //Root groop        root = game.add.group();        //Scene config        var conf = loadXMLString("assets/test.xml");        //Create a new Scene        var scene = new Scene(game,dico);        //Init the scene with the config file        scene.buildFromXml(conf);        //Add the Scene into the root group        root.addChild(scene);        //Retrieve Scene child by thei id        var sceneRoot = scene.getChildByName("root");             var btn = scene.getChildByName("btn");        btn.onInputUp.add(up, this);    }};function up() {   var bmd = game.add.bitmapData(game.width, game.height);bmd.addToWorld();bmd.drawGroup(root);}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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