[]关于切换图片的问题
class Main{
private plane1:string = "res/plane.png";
private plane2:string = "res/untitled.png";
private img: Laya.Sprite;
private flag: boolean = false;
constructor()
{
Laya.init(1000,800);
this.img = new Laya.Sprite;
this.img.loadImage(this.plane1);
Laya.stage.addChild(this.img);
this.img.graphics.clear();
this.img.loadImage(this.plane2);
Laya.stage.addChild(this.img)
}
}
new Main();
出来的结果是两张图合并到了一起,
于是我再尝试
constructor()
{
Laya.init(1000,800);
this.img = new Laya.Sprite;
this.img.loadImage(this.plane1);
this.img.graphics.clear();
Laya.stage.addChild(this.img);
}
发现graphics.clear没有清除掉第一张图片
请问这是怎么回事呢?
private plane1:string = "res/plane.png";
private plane2:string = "res/untitled.png";
private img: Laya.Sprite;
private flag: boolean = false;
constructor()
{
Laya.init(1000,800);
this.img = new Laya.Sprite;
this.img.loadImage(this.plane1);
Laya.stage.addChild(this.img);
this.img.graphics.clear();
this.img.loadImage(this.plane2);
Laya.stage.addChild(this.img)
}
}
new Main();
出来的结果是两张图合并到了一起,
于是我再尝试
constructor()
{
Laya.init(1000,800);
this.img = new Laya.Sprite;
this.img.loadImage(this.plane1);
this.img.graphics.clear();
Laya.stage.addChild(this.img);
}
发现graphics.clear没有清除掉第一张图片
请问这是怎么回事呢?
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_XS
赞同来自: