How does "onEnterFrame = null" differ from "_delete onEnterFrame" ? Should
I prefer one to the other?
onEnterFrame = null - Changes the reference but does not destroy the event.
If the function assigned to the event was anonymous (no other references to
it), it should be cleaned up by the GC on its next pass. Event keeps
broadcasting, but no function is called.
delete onEnterFrame - Deletes the event. If the function assigned to the
event was anonymous (no other references to it), it will also be cleaned up
on the GCs next pass.
Both ways leave the function intact, so if there are references to the
function other than the event the function will continue to exist. In both
cases, if the event was anonymous it will be cleaned by the GC on its next
pass, because the sole reference to it was either destroyed or reassigned.
In this case, the null assignment and delete keyword behave very similarly,
the only discrepancy being that the event continues to fire in the case of
the null assignment, but since the event only calls null, it is so low
overhead as to make almost no difference between the two methods. Any
performance cost of the event continuing to fire is likely negligable,
unless you do this to a whole freakin' lot of movie clips.
ryanm
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com