DragonBones
来源:互联网 发布:网络管理(兼职) 编辑:程序博客网 时间:2024/06/04 22:17
我这边加载完资源以后,创建动画代码如下
this.dragonBonesSkeleData = dragonBones.DataParser.parseDragonBonesData(this.skeletonData);
this.textureAtlas = new dragonBones.EgretTextureAtlas(this.textureData,this.jsonData);
this.egretFactory = new dragonBones.EgretFactory();
this.egretFactory.addDragonBonesData(this.dragonBonesSkeleData);
this.egretFactory.addTextureAtlas(this.textureAtlas);
var armatureName: string = this.skeletonData.armature[0].name;
this.armture = this.egretFactory.buildArmature(armatureName);
this.armtureDisplay = this.armture.display;
dragonBones.WorldClock.clock.add(this.armture);
this.addChild(this.armtureDisplay);
释放如下:
this.egretFactory.dispose();
this.textureAtlas.dispose();
this.dragonBonesSkeleData = null;
if(this.armtureDisplay.parent) this.armtureDisplay.parent.removeChild(this.armtureDisplay);
this.armtureDisplay = null;
this.armture.removeEventListener(dragonBones.AnimationEvent.COMPLETE,this.AnimationComp,this);
dragonBones.WorldClock.clock.remove(this.armture);
this.armture.animation.stop();
this.armture.dispose();
this.armture = null;
现在的问题是,升级到3.1.8以后,同样的动画,释放以后再创建就不显示了,把this.textureAtlas.dispose();去掉就好了
3.0.8下就是可以的
哪位帮忙看一下是不是代码有问题
this.dragonBonesSkeleData = dragonBones.DataParser.parseDragonBonesData(this.skeletonData);
this.textureAtlas = new dragonBones.EgretTextureAtlas(this.textureData,this.jsonData);
this.egretFactory = new dragonBones.EgretFactory();
this.egretFactory.addDragonBonesData(this.dragonBonesSkeleData);
this.egretFactory.addTextureAtlas(this.textureAtlas);
var armatureName: string = this.skeletonData.armature[0].name;
this.armture = this.egretFactory.buildArmature(armatureName);
this.armtureDisplay = this.armture.display;
dragonBones.WorldClock.clock.add(this.armture);
this.addChild(this.armtureDisplay);
释放如下:
this.egretFactory.dispose();
this.textureAtlas.dispose();
this.dragonBonesSkeleData = null;
if(this.armtureDisplay.parent) this.armtureDisplay.parent.removeChild(this.armtureDisplay);
this.armtureDisplay = null;
this.armture.removeEventListener(dragonBones.AnimationEvent.COMPLETE,this.AnimationComp,this);
dragonBones.WorldClock.clock.remove(this.armture);
this.armture.animation.stop();
this.armture.dispose();
this.armture = null;
现在的问题是,升级到3.1.8以后,同样的动画,释放以后再创建就不显示了,把this.textureAtlas.dispose();去掉就好了
3.0.8下就是可以的
哪位帮忙看一下是不是代码有问题
如果不调dispose的话,内存会不会一直占用?因为有些动画不是一直有的,所以用完想释放掉
=====================================================================================
释放包含res 的释放 龙骨数据(在factory里)的释放 龙骨armature实例的释放 你的释放是完全正确的,现在龙骨内部会有对象池机制,所以回收后内存可能并不会下降,但是这并不会引起内存问题,因为内存的峰值始终是你需要的值,不比过多的担心,如果还有问题可以再详细了解,这样做的优势是,减小创建实例的开销,同时不会引起过多的垃圾回收 ...
0 0
- DragonBones
- DragonBones介绍
- DragonBones使用
- DragonBones快速入门指南
- DragonBones快速入门指南
- DragonBones快速入门指南
- DragonBones快速入门指南
- DragonBones快速入门指南
- DragonBones快速入门指南
- DragonBones for Cocos2d-x
- DragonBones快速入门指南
- Cocos2dx加入Dragonbones支持
- dragonbones插件编译
- DragonBones For CocosLua
- 【DragonBones&Unity】关于DragonBones载入Unity的问题
- 【DragonBones】使用DragonBones来创建像素人物骨骼
- DragonBones快速入门指南1
- DragonBones快速入门指南2
- cdsn ——博客
- 低频RFID读卡流程
- [转]xcode提示App Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法
- android面试题(未完)
- 按键驱动(平台文件、中断)
- DragonBones
- spark二次排序
- 仿大街网-堆栈式卡片布局-SwipeCardLayout
- C++学习之重载、覆盖与隐藏
- 面经
- elasticsearch中的doc_values
- 第八周项目3-顺序串算法
- LeetCode 310. Minimum Height Trees题解
- openresty+consul动态配置更新(服务变更发现)