private var mapBit:String;
public function Main()
{
// 不支持WebGL时自动切换至Canvas
Laya.init(920, 640, WebGL);
Laya.stage.bgColor = "#808080";
Laya.stage.scaleMode = Stage.SCALE_NOBORDER;
Laya.stage.screenMode = Stage.SCREEN_HORIZONTAL;
Laya.stage.alignV = Stage.ALIGN_MIDDLE;
Laya.stage.alignH = Stage.ALIGN_CENTER;
Stat.show();
mapBit = "img.png";
Laya.loader.load(mapBit, Handler.create(this, onLoadCom));
}
private function onLoadCom(e:Texture):void
{
sp.graphics.drawTexture(e);
Laya.timer.once(1000, this, function():void
{ trace("clear")
Loader.clearRes(mapBit, true);}
);
}
如果把延时里面的方法改成Loader.clearRes(mapBit, true);图片就没了