[]舞台上有个label,我能通过截图保存成图片么

已邀请:

cuixueying

赞同来自:

Laya.init(800, 800);
Laya.stage.bgColor = "#eeffcc";
Laya.stage.alignH = Stage.ALIGN_CENTER;
Laya.stage.alignV = Stage.ALIGN_MIDDLE;

var sp:Sprite=new Sprite();

sp.graphics.drawRect(0,0,200,200,"#EEFF00");

var label:Label=new Label();
label.fontSize=60;
label.text="666";
label.bold=true;
label.color="#000000";
sp.addChild(label);
sp.size(200,200);

Laya.stage.addChild(sp);

Laya.timer.frameLoop(60,this,function():void{
var htmlC:HTMLCanvas=sp.drawToCanvas(200,200,0,0);
var texture:Texture=new Texture(htmlC);

var sp2:Sprite=new Sprite();
sp2.graphics.drawTexture(texture,100,100,100,100);
sp2.pos(300,0);
Laya.stage.addChild(sp2);
})
注意加个延迟,1-2帧左右即可!

要回复问题请先

商务合作
商务合作