PDA

View Full Version : removing all duplicateMovieClip


rhannam
03-14-2002, 01:43 AM
what i want to do is remove all duplicatemovieclips that i am creating with a movie clip (named controller) that contains the following

onClipEvent (mouseMove) {
if (draw) {
count ++;

_root.dot.duplicateMovieClip("dot" + count, count)

with (_root["dot"+count]) {
_x = _root._xmouse;
_y = _root._ymouse;

"dot" is a seperate movie clip. this all works fine when i test the movie where ever i click and hold the MC dot is repeated.

now i want to create a "reset" button that will delete all instances of "dot" that i have created.... i made a button and attached the following....

on (press) {
count = 1;
while (count<10){
removeMovieClip ("_root.dot" + count);
count = count +1;
}
}

this only deletes the first 10 MC's that are created and no more.....

any suggestions on how to handle this situation....

i am new so please.... be gentle.... thanks

Jesse
03-14-2002, 02:16 AM
for (k=0;k<path.To.count;k++) {
_root["dot"+k].removeMovieClip()
}
You can use that but you will have to change "path.To." to the path tot he count variable (which, judging but your attachMovie code is within a controlle rmovieclip). If indeed the instance name is 'controller', just try:
for (k=0;k<_root.controller.count;k++) {
_root["dot"+k].removeMovieClip()
}

rhannam
03-14-2002, 03:19 AM
thanks!!!!! that totally makes sence and really helps!!!

the only thing that was happening was that the last instance was still showing up, so i changed the code slightly

for (k=0;k-1<_root.controller.count;k++) {
_root["dot"+k].removeMovieClip()

thanks again!!!

farafiro
03-14-2002, 07:37 AM
So why mine doesn't work here it is:

--------------------------------------------
onClipEvent (load) {
_visible = 0;
}
onClipEvent (enterFrame) {
for (i=0; i<_root.arraySize; i++) {
if (hitTest(_root["egg"+_root.array[i]])) {
_root["egg"+_root.array[i]].move = 0;
_root.Lives -= 1;
}
if (_root.score == "5") {
_root.gotoAndPlay("Level1");

}
}
}
----------------------------------------------------------------------------

and I add

_root["egg"+_root.array[i]].removeMovieClip()

after the last if

BUT Why not working??:( :mad:

Jesse
03-15-2002, 04:28 AM
try:
this.hitTest(_root["egg"...