# Hide movieclips

**URL:** <https://forum.kirupa.com/t/hide-movieclips/61934>\
**Category:** Uncategorized\
**Created:** [August 23, 2004, 1:19pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934 "2004-08-23T13:19:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voccart](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@Voccart](https://forum.kirupa.com/u/Voccart)\
**Post date:** [August 23, 2004, 1:19pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/1 "2004-08-23T13:19:20Z")

</div>

Hi people,  
i have the following movieclips running

**\_level0categories0\_mc**

- level0.categories\_mc.categorie0\_mc.index0\_mc
- level0.categories\_mc.categorie0\_mc.index1\_mc
- level0.categories\_mc.categorie0\_mc.index2\_mc

**\_level0categories1\_mc**

- level0.categories\_mc.categorie1\_mc.index3\_mc
- level0.categories\_mc.categorie1\_mc.index4\_mc
- level0.categories\_mc.categorie1\_mc.index5\_mc

**\_level0categories2\_mc**

- level0.categories\_mc.categorie2\_mc.index6\_mc
- level0.categories\_mc.categorie2\_mc.index7\_mc
- level0.categories\_mc.categorie2\_mc.index8\_mc
- level0.categories\_mc.categorie2\_mc.index9\_mc
- level0.categories\_mc.categorie2\_mc.index10\_mc

my question is: when i click a button in …for example…  
…\_level0categories1\_mc… i need to know wich indexe’s there are and hide those movieclips. so in this case index3, index4 and index5  
can someone please help me with this?

thanks

---

<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:** [August 23, 2004, 2:10pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/2 "2004-08-23T14:10:01Z")

</div>

on(release){  
level0.categories\_mc.categorie0\_mc.index3\_mc.\_visible=false;  
level0.categories\_mc.categorie0\_mc.index4\_mc.\_visible=false;  
level0.categories\_mc.categorie0\_mc.index5\_mc.\_visible=false;  
}

i think that’s what you’re getting at

---

<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:** [August 23, 2004, 2:15pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/3 "2004-08-23T14:15:52Z")

</div>

thanks bwh2,

but there is one small prob… i dont know wich indexe’s there are in the level0.categories\_mc.categorie0\_mc… now there are three indexes tomorrow there can be 5 indexes

so i need to find out wich indexes there are and then hide those indexes

thanks for your help

---

<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:** [August 23, 2004, 3:05pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/4 "2004-08-23T15:05:12Z")

</div>

```php

for(var i in _root){
if(typeof (_root*) == 'movieclip' && _root*.substr(35,5) == "index"){
			_root*._visible = false;
//will hide all MCs on root with "index" as substring (35,5)
		}
	}

```

maybe something like that 🙂

---

<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:** [August 23, 2004, 5:22pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/5 "2004-08-23T17:22:19Z")

</div>

```php
 
var NewID = id - 1;
var CatToHideID = "category"+NewID+"_mc";
 
for(var i in _root.categories_mc[CatToHideID]){ 
// trace (i) result is...................
// index5_mc
// index4_mc
// index3_mc
// index2_mc
// index1_mc
// index0_mc
// title_mc
// CatCollapse_btn
// changeIndexHeight
// ReorderCat
// HideCat
// UnhideCat
// title_mc
// id_mc
// ....................................................
 
if(typeof (_root.categories_mc[CatToHideID]*) == 'movieclip' && _root.categories_mc[CatToHideID]*.substr(35,5) == "index"){ 
			_root.categories_mc[CatToHideID]*._visible = false; 
//will hide all MCs on root with "index" as substring (35,5) 
		} 
	} 
 

```

The above code is allmost good. the only thing not working is

```php
_root.categories_mc[CatToHideID]*.substr(35,5) == "index"

```

i did try diff things and no result… i need to be shure that the movieclip to hide the same is as “index” can someone help me with this please…

thanks

---

<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:** [August 23, 2004, 8:10pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/6 "2004-08-23T20:10:00Z")

</div>

hehe okay, i got it allmost working :drool:

```auto
for(var i in _root.categories_mc[CatToHideID]){ 
// trace i result is: index0_mc, index1_mc, index2_mc, title and id
if(typeof (_root.categories_mc[CatToHideID]*) == 'movieclip' && _root.categories_mc[CatToHideID]*.substr(35,5) == "index"){ 
_root.categories_mc[CatToHideID]*._visible = false; 
//will hide all MCs on root with "index" as substring (35,5) 
} 
} 

```

when if i leave it like this nothing happens, but when i delete

```auto
&& _root.categories_mc[CatToHideID]*.substr(35,5) == "index"

```

it works. is there something wrong with that line ?

thanks

---

<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:** [August 25, 2004, 5:32pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/7 "2004-08-25T17:32:32Z")

</div>

bump, oink, boink or whatever :d please someone?

---

<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:** [August 27, 2004, 12:00pm UTC](https://forum.kirupa.com/t/hide-movieclips/61934/8 "2004-08-27T12:00:43Z")

</div>

Finaly!!! i got it working

after :  
40 coffee  
3 showers  
1 long bath  
and the fact that i did pull my hair out it works 😃

instead of

```php
if(typeof (_root.categories_mc[CatToHideID]*) == 'movieclip' && _root.categories_mc[CatToHideID]*.substr(35,5) == "index")

```

i changed this line into

```php
if(typeof (_root.categories_mc[CatToUnHideID]*) == 'movieclip' && i.substr(0, 5) == "index")	

```

[color=#007700]dont ask me why this works, maybe someone can explain?[/color]  
[color=#007700]thanks for the help Uli, bwh2. [/color]
