PDA

View Full Version : class destructors?



voxecho
January 13th, 2006, 03:13 PM
Is there anything like this in a compoenent class? i've searched and not found it. I need to be able to clean up stuff that my movies create (outside their own timeline) when n.removeMovieClip() is called. the only other way i can think of doing this is with a die() function which is used instead of removeMovieClip() but i try to stick with accepted norms as much as possible.

Any thoughts?

Echo

ramie
January 13th, 2006, 03:21 PM
delete is used to destroy an object reference, have a look in the docs



delete a_object

mpelland
January 13th, 2006, 03:29 PM
every time you create something new, add it to an array
create a function that can clean that array out by removing all the clip

expensive_pen
January 13th, 2006, 03:29 PM
delete is used to destroy an object reference, have a look in the docs

ActionScript Code:

delete a_object




i don't think thats what he is asking. I am almost positive there are no destructors

senocular
January 13th, 2006, 03:32 PM
http://www.kirupa.com/developer/oop/AS1OOPInheritance7.htm
same applies to AS 2

expensive_pen
January 13th, 2006, 03:38 PM
http://www.kirupa.com/developer/oop/AS1OOPInheritance7.htm
same applies to AS 2

wow can you get it to work AS2

senocular
January 13th, 2006, 03:49 PM
the concept, not the code

expensive_pen
January 13th, 2006, 03:54 PM
oh oh, i completely misunderstood

voxecho
January 13th, 2006, 03:56 PM
Actually, I think i need to make more clear my question.

i have a component, within the component a mask is made, but the mask actually resides on _parent

_parent.createEmptyMovieClip(..)

so when the instace of the component is removed (being a movieclip, i can't use delete) using removeMovieClip() there is no way to remove the mask object. it has to be on the _parent as it's actually masking something that it's not attached to...

my only solition so far is a die() funciton that kills dependencied BEFORE calling removeMovieClip() but as this is a component, i didn't want to have that extra step. :\


delete is used to destroy an object reference, have a look in the docs

senocular
January 13th, 2006, 04:37 PM
override removeMovieClip
http://www.kirupa.com/developer/oop/AS1OOPClassesWithMCs9.htm

voxecho
January 13th, 2006, 05:14 PM
hmmm, i am not at all sure how i would implament that in AS2 that AS1 stuff makes little sense to me as i went from flash 4 to flash 7 without learning anything in between (long hiatus)

so, i override the superclasses removeMovieClip... but i still need to refernece it eventually and super.removeMovieClip([this]) doesn't seem to do anything.

after you have overrode the superclasses methods, is that the only way to access them, by using super?

-E