[LayaNative 2.0]关于微信小游戏渲染子域图的问题

new Texture(Browser.window.sharedCanvas);
上面这句报错:
gameThirdScriptError
value._addReference is not a function
TypeError: value._addReference is not a function
    at Texture.<anonymous> (http://127.0.0.1:10656/game/js/bundle.js:15188:19)
    at Texture.__proto.setTo (http://127.0.0.1:10656/game/js/bundle.js:15065:14)
    at new Texture (http://127.0.0.1:10656/game/js/bundle.js:15001:8)
    at Main.<anonymous> (http://127.0.0.1:10656/game/js/bundle.js:1196:16)
    at TimerHandler.__proto.run (http://127.0.0.1:10656/game/js/bundle.js:8352:45)
    at Timer.__proto._update (http://127.0.0.1:10656/game/js/bundle.js:8101:15)
    at Stage.__proto.render (http://127.0.0.1:10656/game/js/bundle.js:24593:14)
    at Stage.__proto._loop (http://127.0.0.1:10656/game/js/bundle.js:24517:8)
    at loop (http://127.0.0.1:10656/game/js/bundle.js:8383:15)
 
说是Texture类value && (value._addReference(this._referenceCount)); 这里value._addReference没有,value是个[object HTMLCanvasElement],,死活都画不出来,,
 
主域代码
Laya.timer.once(2000, this, function():void{
var sprite:Sprite = new Sprite();
sprite.pos(0, 0);
var texture:Texture = new Texture(Browser.window.sharedCanvas);
texture.bitmap.alwaysChange = true;//小程序使用,非常费,这个参数可以根据自己的需求适当调整,如果内容不变可以不用设置成true
sprite.graphics.drawTexture(texture, 0, 0, texture.width, texture.height);
Laya.stage.addChild(sprite);
 
});

阿噗

赞同来自:

if(Browser.onMiniGame)
{ WXOpenDataViewer.postMsg({command:"open", curScore:GameModel.getInstance().money, data:{windowWidth:Laya.stage.width, windowHeight:Laya.stage.height}});
}

谢春

赞同来自:

你用的是Laya2吧?Laya2有专门显示子域内容的控件:WXOpenDataViewer    你把Sprite换成这个控件试试

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作