There are just a few things to keep in mind when you destroy objects, you
should remove any broadcasters they are listening to (removeListener(this))
and remove any movieclips that are instantiated during the init process.
Seperate the object from the graphics when you think about your object so
that no orphan movieclips occur when you get rid of the object.

You want to make sure that removeMovieClip will invoke by setting the
movieclip depth equal to or lower than 1048575.

I usually use a die() method which takes care of these things. Maybe a base
object that might implement a die function that did common tasks would be
best, it's how I do it normally so that I don't have to write a die function
for all of my objects.

Any other relationship the object holds with the application should be
considered. I don't think you will have any problems beyond what I've
mentioned if the object is well encapsulated.

I hope this helps,

M.

On 4/26/06, Manuel Saint-Victor <[EMAIL PROTECTED]> wrote:
>
> What is the best way to destroy a Singleton?  I have a program that has a
> videoList when members are logged in - when they log out although the swf
> will still be open I would like that the list (which is a Singleton that
> they can tote around with them throughout the minisite) be destroyed-.  I
> was thinking of creating a destroy method of the singleton that would set
> the _instance value to null and therefore allow the whole creation and
> init() process to be called anew by the login but wondered if I was
> setting
> myself up for a pitfall that I didn't know about.
>
> Thanks,
>
> Mani
> _______________________________________________
> [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
>
_______________________________________________
[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

Reply via email to