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?
I use the delete all the time like you are doing. Flash continues to run
your code until the end of the statement block. I thought that once you
delete something that garbage collection would take over after the
function exits. Someone correct me if I'm wrong.
for example, run this in a new fla
************************
index = 0;
this.onEnterFrame = function () {
if (index==10) {
delete onEnterFrame;
trace("i can still run code but only until the function closes")
}
trace("index="+index++)
}
Judah
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders