0
how to delete a custom class instance?
New Here
,
/t5/animate-discussions/how-to-delete-a-custom-class-instance/td-p/907299
Oct 05, 2008
Oct 05, 2008
Copy link to clipboard
Copied
hey everyone, i need some help with deleting class instances.
say i have a bullet class. say the bullet class checks when the
bullet hits an enemy. i need help with how to delete the bullet
when it hits the enemy.
im really struggling with this and any help would be helpful.
thnx
im really struggling with this and any help would be helpful.
thnx
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/animate-discussions/how-to-delete-a-custom-class-instance/m-p/907300#M22838
Oct 05, 2008
Oct 05, 2008
Copy link to clipboard
Copied
Do all of the following:
(1) removeChild so that it is not on the display list anywhere.
(2) Remove all references to the display object. For example, you can set them to null.
(3) Remove all event listeners attached to the instance.
(4) Think positive thoughts and hope it works.
(1) removeChild so that it is not on the display list anywhere.
(2) Remove all references to the display object. For example, you can set them to null.
(3) Remove all event listeners attached to the instance.
(4) Think positive thoughts and hope it works.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Jerome_Squalor
AUTHOR
New Here
,
/t5/animate-discussions/how-to-delete-a-custom-class-instance/m-p/907301#M22839
Oct 05, 2008
Oct 05, 2008
Copy link to clipboard
Copied
hi, can you show me how to do that with code within my
deleter class?
i dont know if what i have is correct or not so feel free to change it.
i dont know if what i have is correct or not so feel free to change it.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/animate-discussions/how-to-delete-a-custom-class-instance/m-p/907302#M22840
Oct 05, 2008
Oct 05, 2008
Copy link to clipboard
Copied
it can't be done in a deleter class unless all references are
passed to the class or created in the class so the deleter class
has access to all references.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Jerome_Squalor
AUTHOR
New Here
,
/t5/animate-discussions/how-to-delete-a-custom-class-instance/m-p/907303#M22841
Oct 05, 2008
Oct 05, 2008
Copy link to clipboard
Copied
what do you mean? what are references?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/animate-discussions/how-to-delete-a-custom-class-instance/m-p/907304#M22842
Oct 06, 2008
Oct 06, 2008
Copy link to clipboard
Copied
anything that refers to the movieclip you're trying to use.
for example, when you add a listener, that creates a reference so you need to remove the listener. when you use a variable to point to your movieclip, that variable needs to be removed. when you store the movieclip in an array, that array element needs to be removed.
and, in your situation, you're not removing the movieclip. you're removing the array reference only so you can be sure your movieclip is not going to be gc'd.
for example, when you add a listener, that creates a reference so you need to remove the listener. when you use a variable to point to your movieclip, that variable needs to be removed. when you store the movieclip in an array, that array element needs to be removed.
and, in your situation, you're not removing the movieclip. you're removing the array reference only so you can be sure your movieclip is not going to be gc'd.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

