[]l龙骨动画内存上升
我发现 我的龙骨动画播放的时候 播放完成,如果清除龙骨对象就会报错;不清除 内存就会不断上升,求解决方法 留言给我;要下班了;谢谢 大家
public function LayaSample() {
//初始化引擎
Laya.init(1136, 640, WebGL);
Laya.stage.bgColor = "#ffffff";
Laya.stage.on(Event.CLICK, this, play);
}
function play():void {
Laya.timer.loop(5000, this, function():void {
playDragonBonesAnimation("BigAward/BigAward.sk",0,0,Laya.stage,false);
});
}
/**播放龙骨动画
* @param url 动画的路径
* @param dragronX 动画显示x坐标
* @param dragronY 动画显示y坐标
* @param parent 龙骨动画父容器
* @param isLoop 是否循环播放
*/
private function playDragonBonesAnimation(url:String,dragronX:Number,dragronY:Number,parent:Sprite,isLoop:Boolean):void{
var tem:Templet = new Templet();
var longgu:Skeleton;
tem.loadAni(url);
tem.on(Event.COMPLETE, this, function():void {
longgu = tem.buildArmature(0);
longgu.pos(dragronX, dragronY);
parent.addChild(longgu);
longgu.play(0, isLoop);
longgu.on(Event.STOPPED, this, function():void {
Laya.stage.removeChild(longgu);
//longgu.destroy();
tem.destroy();
});
});
}
public function LayaSample() {
//初始化引擎
Laya.init(1136, 640, WebGL);
Laya.stage.bgColor = "#ffffff";
Laya.stage.on(Event.CLICK, this, play);
}
function play():void {
Laya.timer.loop(5000, this, function():void {
playDragonBonesAnimation("BigAward/BigAward.sk",0,0,Laya.stage,false);
});
}
/**播放龙骨动画
* @param url 动画的路径
* @param dragronX 动画显示x坐标
* @param dragronY 动画显示y坐标
* @param parent 龙骨动画父容器
* @param isLoop 是否循环播放
*/
private function playDragonBonesAnimation(url:String,dragronX:Number,dragronY:Number,parent:Sprite,isLoop:Boolean):void{
var tem:Templet = new Templet();
var longgu:Skeleton;
tem.loadAni(url);
tem.on(Event.COMPLETE, this, function():void {
longgu = tem.buildArmature(0);
longgu.pos(dragronX, dragronY);
parent.addChild(longgu);
longgu.play(0, isLoop);
longgu.on(Event.STOPPED, this, function():void {
Laya.stage.removeChild(longgu);
//longgu.destroy();
tem.destroy();
});
});
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
cuixueying
赞同来自: