lindell Posted June 9, 2015 Share Posted June 9, 2015 I have a static Container object that I set to cacheAsBitmap = true.Even if it is static. Changes sometimes occur and wich means I want to redraw(/reCache) it at the next render.I accidentally viewed the documentation for Pixi 2 and saw updateCache which seems to be what I want but I can't find it or anything similar in the documentation for V3.How do I do this? Quote Link to comment Share on other sites More sharing options...
xerver Posted June 9, 2015 Share Posted June 9, 2015 Can always just set "cacheAsBitmap" to false, then back to true. Quote Link to comment Share on other sites More sharing options...
lindell Posted June 9, 2015 Author Share Posted June 9, 2015 Can always just set "cacheAsBitmap" to false, then back to true.But I do only want to do this one time, at the next redraw. Then I need to know when the stage is redrawn and set it back. I could do this but it feels like there is an easier way Quote Link to comment Share on other sites More sharing options...
xerver Posted June 9, 2015 Share Posted June 9, 2015 I'm not sure what you mean, what I am saying is do this: function updateCachedBitmap(obj) { obj.cacheAsBitmap = false; // disable and cleanup currently cached bitmap obj.cacheAsBitmap = true; // enable and recreate cached bitmap}If you find you will be wanting to update something, it will probably be easier to just do it with a render texture and have full control:var texture = new PIXI.RenderTexture(renderer), sprite = new PIXI.Sprite(texture);texture.render(container); //whatever container you are currently cacheAsBitmap-ing// whenever you need to update the cached texture just do it:texture.render(container); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.