[Flashcoders] destructors...

2006-05-04 Thread Bjorn Schultheiss
I have tried various ways of destroying instances. I once used this type of implementation // Parent Class function buildChild() { var myClass : MyClass = new MyClass(); myClass.addEventListener( "onDestroyChild", this ); } function onDestroyChild( evt : Object ) { if ( H

RE: [Flashcoders] destructors...

2006-05-04 Thread James Booth
AM To: Flashcoders mailing list Subject: Re: [Flashcoders] destructors... Yep - that works perfectly well. But it's always better to avoid situations like this: > Some of the developers used the same classes and > slightly modified them for their needs. by assigning different package na

Re: [Flashcoders] destructors...

2006-05-04 Thread Ian Thomas
Yep - that works perfectly well. But it's always better to avoid situations like this: Some of the developers used the same classes and slightly modified them for their needs. by assigning different package names to different modules, if you know they'll all be running in the same 'container' ap

Re: [Flashcoders] destructors...

2006-05-04 Thread jeboothjr
gt; Date: Thursday, May 4, 2006 9:36 am Subject: Re: [Flashcoders] destructors... To: Flashcoders mailing list > Ian's right. > > ActionScript is a dynamic language with its own garbage > collection, for > better or for worse. If you try to apply all the same practices and &

RE: [Flashcoders] destructors...

2006-05-04 Thread Tom Lee
:09 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] destructors... Wait though, isn't a class part of the swf compilation? Technically, you really cannot delete it unless you load the class in via an external swf. That might be one way of accually doing it. M. On 5/3/06, Andreas Røn

Re: [Flashcoders] destructors...

2006-05-04 Thread Ian Thomas
Good point. I assumed - Andreas - that you were talking about deleting _instances_ of a class; not actual classes. :-) Ian On 5/4/06, elibol <[EMAIL PROTECTED]> wrote: Wait though, isn't a class part of the swf compilation? Technically, you really cannot delete it unless you load the class in

Re: [Flashcoders] destructors...

2006-05-04 Thread elibol
Wait though, isn't a class part of the swf compilation? Technically, you really cannot delete it unless you load the class in via an external swf. That might be one way of accually doing it. M. On 5/3/06, Andreas Rønning <[EMAIL PROTECTED]> wrote: Kind of besides the point really. The real po

Re: [Flashcoders] destructors...

2006-05-04 Thread Tyler Wright
Ian's right. ActionScript is a dynamic language with its own garbage collection, for better or for worse. If you try to apply all the same practices and rulesfrom strict-typed languages that requre manual memory management you'll go crazy. The best thing to do is to realize this type of languages

Re: [Flashcoders] destructors...

2006-05-03 Thread Ian Thomas
Um - I'm not sure it is beside the point. :-) Given that you are at the mercy of the garbage collector, implementing a function like: class MyClass { function cleanup() { delete _someProp; delete _someOtherProp; } } is pointless anyway, because if you delete an object of MyClass (or rat

Re: [Flashcoders] destructors...

2006-05-03 Thread Bart Wttewaall
When using classes that extend from MovieClip, you can use onUnload(). I use it primairaly for removing EventListeners so I won't get stuck with duplicate eventcalls. When you want to delete a class all you really have to do is remove all instances and references from that class. I don't think th

Re: [Flashcoders] destructors...

2006-05-03 Thread Andreas Rønning
Kind of besides the point really. The real point is, in my humble opinion, that it should be possible to do it without myClass.cleanup(); delete(myClass); It becomes double naughty if your class instance is in an array. It's just a question of keeping the amount of fluff down to a minimum. This

Re: [Flashcoders] destructors...

2006-05-03 Thread Ian Thomas
Hi Andreas, To turn it on its head... What are you trying to achieve? In what circumstances do you need to destroy a class? Ian On 5/3/06, Andreas Rønning <[EMAIL PROTECTED]> wrote: has anyone got a good way for an as2 class to destroy itself? I know it's not "possible", but my heart tells m

[Flashcoders] destructors...

2006-05-03 Thread Andreas Rønning
has anyone got a good way for an as2 class to destroy itself? I know it's not "possible", but my heart tells me someone has devised some kind of good methodology. - A ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search