Legal or not, it's very unwise to let an object kill itself. Letting an object commit suicide would leave the rest of a program in a lurch as it wouldn't really know where to go from there. You haven't officially returned back to the caller at that point. You are better off sending out an event to a container object that will put you on death row, so you can be properly disposed of when you are finished executing.

jord

On Dec 21, 2005, at 8:44 AM, Mark Burvill wrote:

   public function die():Void {
       trace ("deleting");
       removeMovieClip (baddie_mc);
       delete this;
       trace ("Am i still alive?");
   }

The movieclip is successfully removed, but I would expect the second trace "Am I still alive" NOT to appear as the object has been deleted, but it does. I read somewhere that it is illegal for an object to delete itself - is this true?
Is there another easy way of doing this?

--
Jordan L. Chilcott, President
Interactivity Unlimited
Guelph, Ontario
---------------------------------
Tel:  (519) 837-1879
eFax: (253) 276-8631

mailto:[EMAIL PROTECTED]
http://www.interactivityunlimited.com
iChat/AIM: j1chilcott

Author: "Building Web Sites with Macromedia Studio MX"
Author: "Building Dynamic Web Sites with Macromedia Studio MX"
Author: "Flash Professional 8: Training From the Source"


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to