Flash memory management and Actionscript -


there many discussions problem, want pay attention on situations imho seems not clear:

yes general rules are: remove chachedasbitmap stop movieclip if playing remove events delete references etc.

but let's look:

first example: have nested sprite (ex: mainsprite), contains other sprites dynamic textfields in (and chached bitmaps), textfileds , movieclips event listeners on (with weak reference). when need remove sprite need first remove it's nested content via loops or just

removechild(mainsprite); mainsprite=null; 

is enough?

second example: have sprite in i'm loading bitmap , manipulating bitmapdata, later i'm replacing content of sprite bitmap, allocated memory older bitmap automatically erases , overwritten or still exists?

third example: have "graphics template" movieclip (in library export actionscript property set on it) i'm adding on stage , filling dynamic data (and adding event listeners), let's it's 1 scene of app, on scene need same movieclip other dynamic data, inbetween need clear stage (need transition animation library movieclip), what's best way: set movieclip visible property false (while transition animation plays) , reuse it, or remove removechild , add when add addchild once more?

all wrote more air mobile, cause in cases desktop these situations aren't problematic, in case of mobile development are.

you can visually monitor memory usage along fps etc using lib: http://code.google.com/p/flash-console/

hope helps.

p.s. gc in flash weird thing :)


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -