Hello,
I’ve seem to have hit a snafu in a small animation I am creating for my next tutorial. What I have, is a movie clip that gets duplicated when the space bar is pressed. The movieclip has actions setup so that when the movieclip reaches a certain y value, it will remove itself via this.removeMovieClip()
The problem is, every movie clip that is duplicated does remove itself like it is supposed to. The exception is the original movie clip that I duplicate from. That movie clip seems to want to stay and cause problems (it is not removing itself because it isn’t duplicated via attachmovie or the duplicateMovieClip method).
I have included an attachment if it may help someone.
lol, yeah I actually did find that thread =) The problem is that any actions in the onEnterFrame of that movie clip continue executing, and that will eventually cause system resources to be wasted on that movie clip. Does setting the visibility to false prevent any actions from executing as well?
removing the clip will also remove the onEnterFrame events associated with that clip (it should at least)… that is unless that event is being handled through some other object.
_visible only affects the visual aspect of the clip on the screen. Scripts running in an invisible clip will continue to run even when a movieClip’s _visible is set to false.
I downloaded the fla… the problem youd be having is that your duplicated clip retains the same properties of all the bullets… that being moving up nd killing itself after y < 0. If you remove the main bullet, you can no longer dupicate it. So thats something you really dont WANT to do, atleast not until you never want to shoot again.
If you dont like the fact that the original bullet is always there, you can use attachMovie instead. Event handling can be done on a second frame with a gotoAndPlay(1) within that bullet, or by having in that bullet another movieclip and use movieClip events on that to control its _parent (which is the main bullet itself)