Thanks Roman!
I will make it a practice to start dumping the variables after I don't need them!
--dan

Roman Blöth wrote:

dls schrieb:

Might be counting angels on a pin head here, but:

if I set alot ( think hundreds) of _global variables  such as:
_global.state1 = Wisconsin;

I assume they slow the performance of my player.
Is there a way to clear them after use?
(or more specifically, the ones I don't need -- I could figure out how to specify that in the code....)

Oh my, this really is a matter in Flash... Since we have often experienced variable's values not being cleared after use, we do the following:

my_var = null; // This first step probably is useless, but ALWAYS use DELETE!
delete my_var;

If the value contained within the variable is a movieclip, then make sure that this mc has an "onUnload"-handler that does the above with all variables and to avoid instances from floating in memory after having deleted, unloaded and removed them, if possible don't use static values!

I have made the experience that static instances stay in memory after there is no reference to them left, since I set them all to null and then deleted them. Then, when I re-create an instance of such static stuff, it isn't created anew, but Flash uses the old piece that rests in memory.

Maybe it's just that I don't really, really understand the concept of "static", but I know it can lead to unpredictable and hard-to-track errors.


Best regards,
Roman.

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to