# Need help

**URL:** <https://forum.kirupa.com/t/need-help/10855>\
**Category:** Uncategorized\
**Created:** [January 8, 2003, 1:59pm UTC](https://forum.kirupa.com/t/need-help/10855 "2003-01-08T13:59:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BOla](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@BOla](https://forum.kirupa.com/u/BOla)\
**Post date:** [January 8, 2003, 1:59pm UTC](https://forum.kirupa.com/t/need-help/10855/1 "2003-01-08T13:59:35Z")

</div>

Hi

Is there possible with a command to stop all movieclips on the scene ??

Need help real fast…

---

<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:** [January 8, 2003, 2:30pm UTC](https://forum.kirupa.com/t/need-help/10855/2 "2003-01-08T14:30:05Z")

</div>

```auto

MovieClip.prototype.stopAll = function(){
	this.stop();
	var obj;
	for (obj in this) if (typeof this[obj] == "movieclip") this[obj].stopAll();
}

_root.stopAll();

```

---

<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:** [January 8, 2003, 2:46pm UTC](https://forum.kirupa.com/t/need-help/10855/3 "2003-01-08T14:46:40Z")

</div>

thanks for the fast answer

---

<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:** [January 8, 2003, 2:50pm UTC](https://forum.kirupa.com/t/need-help/10855/4 "2003-01-08T14:50:59Z")

</div>

How do I get the movieclips startded again then ? =) (I´m sorry for my bad knowledge in Flash)

---

<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:** [January 8, 2003, 2:52pm UTC](https://forum.kirupa.com/t/need-help/10855/5 "2003-01-08T14:52:40Z")

</div>

```auto

MovieClip.prototype.playAll = function(){
	this.play();
	var obj;
	for (obj in this) if (typeof this[obj] == "movieclip") this[obj].playAll();
}

_root.playAll();

```

---

<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:** [January 8, 2003, 3:26pm UTC](https://forum.kirupa.com/t/need-help/10855/6 "2003-01-08T15:26:33Z")

</div>

😛 😛

---

<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:** [January 8, 2003, 3:55pm UTC](https://forum.kirupa.com/t/need-help/10855/7 "2003-01-08T15:55:17Z")

</div>

I should note if you have any variables in movieclips referencing another movieclips higher in the heirarchy, you’ll get caught in an infinite loop and flash will eventually exit the script (yes flash will exit it automatically because it uses recursion and Flash stops after 256 recursive calls).

I didnt think it would be a problem so I didnt include a check for that. An easy way is just to include something like

if (typeof this[obj] == “movieclip” && this[obj].\_parent == this)

which will work 99% of the time, but \_parent isnt read only, meaning you can change it to be whatever you want, and if you make it say, \_root, then you get caught in that loop again. So instead a safer technique is

```auto

MovieClip.prototype.stopAll = function(){
	this.stop();
	var obj;
	for (obj in this){
		if (typeof this[obj] == "movieclip"){
			var ttarg = (this._target != "/") ? this._target : ""; // "" for _root
			var otarg = this[obj]._target.substr(0,this[obj]._target.lastIndexOf("/")); // objs _parent's target
			if (ttarg == otarg) this[obj].stopAll();
		}
	}
}

```

which seems a little overkill… and is more than likely completely unnecessary as long as you dont try to reassign the \_parent property of movieclips
