Open adamlwgriffiths opened 9 years ago
Hi @adamlwgriffiths ,
I'm sorry, I didn't understand what your problem is.
Yes, _getFrameConfig
released the resource from cc.loader
(for reduce memory consumption), it also save the result of plist into _frameConfigCache
.
var cfg = this._frameConfigCache[url] = {
_inited : true,
frames : frames,
meta : meta
};
If you call addSpriteFrames
again, it will return the result from _frameConfigCache
directly.
var frameConfig = self._frameConfigCache[url] || self._getFrameConfig(url);
Best regards David
Because the API doesn't let me get frame data from the animation, I need that plist file so I can read the frame names and construct an animation.
I'm not going to hard code in for x in y: add 'hard_coded_frame_' + x to animation
for every animation I create (as your examples do), thats insane.
But the plist has been removed from the cache, and trying to get it results in errors.
I've explicitly asked for it to be cached by adding it to the resources.js file, I doesn't make sense to remove it unless I explicitly ask for it to be.
The private _frameConfigCache
variable was my previous "work around" for this deficiency.
This obviously doesn't exist in Cocos2d-X and is therefore non-portable and not feasible.
Loading an animation using cc.spriteFrameCache causes the resource to be removed from the loader cache. This makes work arounds for dynamically loading frame names from plists (an unbelievable oversight in the API) a hit-and-miss affair as resources disappear.
http://www.cocos2d-x.org/reference/html5-js/V3.2/symbols/src/_Users_panda_StudyWork_Cocos_cocos2d-js_frameworks_cocos2d-html5_cocos2d_core_sprites_CCSpriteFrameCache.js.html