html5 - release used resources in createjs -
i have container multiple sprite , movieclip objects displayed on stage
, sprites use 3mb png spritesheet.
@ point load spritesheet
in order display different container
which uses it.
along process of trial , error, i've seen setting visible
property of container
isn't enough, used removechild(), , cache(), both of helped proper framerate.
problem load more containers , spritesheets, framerate gets low.
there other steps should take in order release used resources?
common pitfalls?
yes, had quite bit of performance problems myself, when first started creating applications in createjs.
if frame rate lower should be, make sure cache every object isn't created bitmap, since not refreshed , don't consume performance. example, shape type objects refreshed , performance intensive.
you should use following pattern objects don't have animated content:
var bounds = displayobject.nominalbounds; displayobject.cache(bounds.x, bounds.y, bounds.width, bounds.height);
this cache object , make consume no performance. also, when time rid of it, make sure displose of assets using like:
//if added child of container displayobject.parent.removechild(displayobject); //if cached prior displayobject.uncache(); //when don't need anymore, garbage collection displayobject = null;
Comments
Post a Comment