I have an array of objects, when another object hits one of them, the object will be deleted. I removed it from the scene using removeChild () and removed it from the array using splice (), but somehow the object still calls some of its functions that cause errors. How to completely get rid of an object? Event listeners are not connected to it either.
You need to make sure that the display object you are deleting is:
stage.removeEventListener(...)
stage.addEventListener(...)
Event.ENTER_FRAME
setInterval
, removeChild , , stop, , . , halt, cleanup finalize, , , -, .., (.. to null) , , .
removeChild
stop
halt
cleanup
finalize
null
, flash-.
Flash Player 10 API, :
unloadAndStop()
: http://www.gskinner.com/blog/archives/2008/07/unloadandstop_i.html
- Flash Player 10 :
http://labs.adobe.com/technologies/flashplayer10/
mesh@adobe.com
AS3, null. , . , " " . , .
addEventListener(SomeEvent.EVENT_HAPPEND, onEventHappend);
, .
addEventListener(SomeEvent.EVENT_HAPPEND, onEventHappend, false, 0, true);
, , . , onEventHappened (true) (false, ). , , . , , . true false, true, .
MovieClip, ? , . , - ( ) . .
, , , setTimeOut -, . , . ?
, . , .
Also remember to stop and delete any related timers when deleting deleted objects: BIT-101: Starting timers is not garbage collection. Ever.
I would look at Event.ENTER_FRAME and TimerEvent.TIMER listeners, make sure they were canceled before the object was deleted.
Source: https://habr.com/ru/post/1696924/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1696919/good-ways-to-test-a-unit-that-communicates-via-http&usg=ALkJrhgrT2CtGkny8xKgfOEBVnxmslFJVQCentering text Using CSS doesn't work in IE - cssАлгоритм поиска символов в тех же позициях в списке строк? - stringGiven an unsigned int, what's the fastest way to get the “indices” of given bits? - algorithmAny recommendation on translation / localization tools in .NET? - .netHow can you insure code execution without changing runtime due to cache? - profilingHow do you check cookies in MVC.net? - unit-testingXML serialization and empty collections - c #Server performance metrics for LAMP - performanceHow can I create JavaScript created using document.write () to execute? - javascriptAll Articles