# Var

**URL:** <https://forum.kirupa.com/t/var/16217>\
**Category:** Uncategorized\
**Created:** [March 22, 2003, 9:09am UTC](https://forum.kirupa.com/t/var/16217 "2003-03-22T09:09:30Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 22, 2003, 2:34pm UTC](https://forum.kirupa.com/t/var/16217/21 "2003-03-22T14:34:39Z")

</div>

is there a way to remove all other clips, in stead of specifying whitch to remove?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 22, 2003, 2:44pm UTC](https://forum.kirupa.com/t/var/16217/22 "2003-03-22T14:44:14Z")

</div>

Well… I think you can store all the names of movieclip to the array when you do the attachMovie() and keep the list in tact whenever you add/remove individual ones, and if you need to remove all of them, just make full loop in the array to get rid of them all…

As an alternative, you can put the whole thing into another movieclip and delte it if you want to… Like…  
\_root.holderMC.attachMovie(blah blah…  
\_root.holderMC.removeMovieClip();

Know what I mean???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 22, 2003, 3:15pm UTC](https://forum.kirupa.com/t/var/16217/23 "2003-03-22T15:15:07Z")

</div>

after all the posts i made u should know that i dont know what u mean;)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 7:28am UTC](https://forum.kirupa.com/t/var/16217/24 "2003-03-23T07:28:45Z")

</div>

Um… Okay… That ain’t funny… :beam:

Put this in the first frame of the main timeline…

```auto
_global.instanceArray = new Array()

```

and on all the place where you have this attachMovie() command, try this…

```auto

instanceName = "megani" + (_global.depth + 1);
_globa.instanceArray.push(instanceName);
var newMc = _root.attachMovie("megmain", instanceName, _global.depth++);

```

What I just did is to add the name of the instances you are creating to the array on the main timeline…

Now, to delete all of them,

```auto
for (i = 0 ; i < _global.instanceArray.length ; i++)
{
   _root[_global.instanceArray*].removeMovieClip();
}
_global.instanceArray = null;

```

I think this should work… At least you get the idea, right??? Let me know… 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 9:27am UTC](https://forum.kirupa.com/t/var/16217/25 "2003-03-23T09:27:59Z")

</div>

i tryeid it, not sure if i did it right, but now the moive freezes, and then crashes the player=(

u know what i could have done wrong? would u take a look if i posted it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 9:51am UTC](https://forum.kirupa.com/t/var/16217/26 "2003-03-23T09:51:58Z")

</div>

Crash??? ☹

Yes… Put it up and I’ll see what I can do…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 10:27am UTC](https://forum.kirupa.com/t/var/16217/27 "2003-03-23T10:27:08Z")

</div>

thanks man, its on here now:  
[http://www.pro](http://www.pro)\*\*\*\*.com/potofolio/pro6.fla

the \*\*\*\* is s\_h\_i\_t (hope the admins can forgive my adress!=)

man, i got me a fever, \*\*\*\* im workin slow today

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:10am UTC](https://forum.kirupa.com/t/var/16217/28 "2003-03-23T11:10:30Z")

</div>

Well… I do not know the words in there, so I am not reall understanding it, but maybe you could tell me why you have this script under ‘megmain’??? Why are you letting Flash keep attach movieclips without user’s interaction, I mean button press???

```auto
instanceName = "kompetansemain"+(_global.depth+1);
_globa.instanceArray.push(instanceName);
var newMc = _root.attachMovie("kompetansemain", kompetansemain, _global.depth++);

instanceName = "portfoliomain"+(_global.depth+1);
_globa.instanceArray.push(instanceName);
var newMc = _root.attachMovie("portfoliomain", portfoliomain, _global.depth++);

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:50am UTC](https://forum.kirupa.com/t/var/16217/29 "2003-03-23T11:50:20Z")

</div>

i thought that i had to put it there, so its realy supposed to be on the buttons?

when uve had enouf of my \*\*\*\* joust tell me=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:53am UTC](https://forum.kirupa.com/t/var/16217/30 "2003-03-23T11:53:41Z")

</div>

Yes… I think that should go into the buttons… 😉

Please do us all a favor and do not use foul languages… I don’t like to see ‘\*\*\*\*’ when I read other people’s post… I don’t know how fun it is to you, but it is not to me… ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:56am UTC](https://forum.kirupa.com/t/var/16217/31 "2003-03-23T11:56:29Z")

</div>

ill stop the fouls

ok, cool and i need to put one for eatch clip right, like i did?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 11:57am UTC](https://forum.kirupa.com/t/var/16217/32 "2003-03-23T11:57:18Z")

</div>

Yes, please… 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:22pm UTC](https://forum.kirupa.com/t/var/16217/33 "2003-03-23T12:22:01Z")

</div>

this is weird, i think i put it in the right places. but it still dont remove the old clips.

I put that code on the timeline where i want it to be removed.  
ive posted the file on the net if u want to take a look

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:26pm UTC](https://forum.kirupa.com/t/var/16217/34 "2003-03-23T12:26:20Z")

</div>

The same address with 1.7mb file again??? I’m on 56k… ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:30pm UTC](https://forum.kirupa.com/t/var/16217/35 "2003-03-23T12:30:40Z")

</div>

ok, thats not to cool then=) im dont wanna ruin u!

but heres what i did:

i put the

instanceName = “megani” + (\_global.depth + 1);  
\_globa.instanceArray.push(instanceName);  
var newMc = \_root.attachMovie(“megmain”, instanceName, \_global.depth++);

on the square buttons

and i put the

for (i = 0 ; i \< \_global.instanceArray.length ; i++)  
{  
\_root[\_global.instanceArray\*].removeMovieClip();  
}  
\_global.instanceArray = null;

on the timeline in the clips were i wanted to remove the other clips.

and i put this

\_global.instanceArray = new Array()

on the first scene in the first frame

have i done something wrong here(probably=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:34pm UTC](https://forum.kirupa.com/t/var/16217/36 "2003-03-23T12:34:37Z")

</div>

Okay… This is the part I don’t understand…

When is the time where you want to delete all those movieclip instances??? If it is a button, what is the name of the button???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:36pm UTC](https://forum.kirupa.com/t/var/16217/37 "2003-03-23T12:36:24Z")

</div>

thats supposed to be on a button to?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:43pm UTC](https://forum.kirupa.com/t/var/16217/38 "2003-03-23T12:43:01Z")

</div>

ok, now i put it on the button, and it looks like this

on (release) {  
instanceName = “megmain” + (\_global.depth + 1);  
\_globa.instanceArray.push(megmain);  
var newMc = \_root.attachMovie(“megmain”, megmain, \_global.depth++);  
newMc.\_x = 0;  
newMc.\_y = 0;  
}  
on (release) {  
for (i = 0 ; i \< \_global.instanceArray.length ; i++)  
{  
\_root[\_global.instanceArray\*].removeMovieClip();  
}  
\_global.instanceArray = null;

}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:43pm UTC](https://forum.kirupa.com/t/var/16217/39 "2003-03-23T12:43:31Z")

</div>

Um… I am not following you… I thought that you want to add the layer on top of each attached movieclips… and now you are saying that you want to remove them all at the same time???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:43pm UTC](https://forum.kirupa.com/t/var/16217/40 "2003-03-23T12:43:48Z")

</div>

but it dont work

[Previous page](https://forum.kirupa.com/t/var/16217.md?page=1)

[Next page](https://forum.kirupa.com/t/var/16217.md?page=3)
