define('DISALLOW_FILE_EDIT', true); Comments on: Stop All Child MovieClips in Flash with Actionscript 3.0 http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/ Home of Scripts 'n Styles for WordPress, Backstage2D and History Keeper! Wed, 25 Sep 2013 12:15:12 +0000 hourly 1 https://wordpress.org/?v=6.2.5 By: thx http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-63296 Wed, 25 Sep 2013 12:15:12 +0000 http://www.unfocus.com/?p=362#comment-63296 thank u !

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-39083 Tue, 10 Jul 2012 14:04:48 +0000 http://www.unfocus.com/?p=362#comment-39083 In reply to Amit Kumar.

That looks like you are trying to pass a instance of MouseEvent to something that expects DisplayObjectContainer (like stopAll). You may have done this:

someBtn.addEventListener(MouseEvent.CLICK, stopAll)

When you need to do this:

someBtn.addEventListener( MouseEvent.CLICK,
function stopHandler( event:MouseEvent ):void {
stopAll( yourMovie );
}
);

]]>
By: Amit Kumar http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-38677 Fri, 29 Jun 2012 11:30:47 +0000 http://www.unfocus.com/?p=362#comment-38677 I got this error..

TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::MouseEvent@3c8ef299 to flash.display.DisplayObjectContainer.

can anybody help me out …

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-21713 Wed, 09 Nov 2011 19:18:06 +0000 http://www.unfocus.com/?p=362#comment-21713 In reply to kumaravelu.

I’m afraid that’s outside of the scope of this function.

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-21703 Wed, 09 Nov 2011 16:13:31 +0000 http://www.unfocus.com/?p=362#comment-21703 In reply to annam.

That is pretty strange. I’d probably have to see the fla to determine why that happens – unless it’s Flash 9 publish target. Flash 9’s MovieClip functionality is way buggy. If you are targeting Flash 9, I’d suggest kicking it up to Flash 10. They fixed enough bugs to make it worth it.

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-21702 Wed, 09 Nov 2011 16:11:19 +0000 http://www.unfocus.com/?p=362#comment-21702 In reply to Nathan Wallis.

That makes sense, though I can imagine some edge cases where that might fail (what if the currentFrame ticks forward, but a frame based stop event is meant to stop the clip?).

You could probably use a self removing ENTER_FRAME event listener instead of the timeout to make it work for a wider range of framerates.

MovieClip.player and Flash Player 11+ seems like a good way to go. 🙂

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-21701 Wed, 09 Nov 2011 16:07:43 +0000 http://www.unfocus.com/?p=362#comment-21701 In reply to Nathan Wallis.

Unfortunately, you can’t easily figure out if the MovieClip instance you are stopping is currently playing or not in Flash 10.3 and lower (actually, there is no general way to do it – you have to build a framework). They did add a “playing” property for Flash Player 11 content, so going forward, this will become possible.

]]>
By: annam http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-21665 Tue, 08 Nov 2011 19:55:02 +0000 http://www.unfocus.com/?p=362#comment-21665 Thanks for the script! funny thing though, I have 4 instances of the same movieclip, playing out of sync, in the main movieclip which I’m stopping with the script. Instance 1 stops fine. Instance 4 stops fine. Instances 2 and 3 stop, but are sent back in their timelines to the same frame as Instance 4 stopped at.

]]>
By: Nathan Wallis http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-20739 Thu, 20 Oct 2011 00:49:16 +0000 http://www.unfocus.com/?p=362#comment-20739 Well I think I have a solution for this problem.

The first technique I described in my previous post seems to do the trick. What I do is upon PAUSE being required, I maintain a Dictionary of all the child objects and their current frame.

Then set a Timer with a delay of 500/stage.frameRate. I agree that 500 is a bit abitrary, but its to make sure that the frame will have changed. Of course if you have a very slow running application where there its not running at your desired frame rate, then I guess this logic could be a problem. In my case its ok, as my screens are very basic and its known what hardware I will be running on. So this may not be the *perfect* solution, but its close enough for my needs.

Then when the Timer ticks over, compare each key in the Dictionary and its value and see if the currentFrame of the key has changed, if not, remove it from the dictionary, if so, then stop the item and update the value of the key to its new frame.

I then use the dictionary when it comes to unpausing and gotoAndPlay(value) of each key in the dictionary. Seems to work so far..

]]>
By: Nathan Wallis http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-20734 Wed, 19 Oct 2011 23:51:33 +0000 http://www.unfocus.com/?p=362#comment-20734 Hi there..

Heheh, I just wrote a recursive function to do the same thing. However, I just hit a roadblock when it came to restarting the clips.

How do you know which ones to restart??!! Only method I could think of would be to wait for 1/stage.frameRate milliseconds and see if the currentFrame changes, but that would be pretty useless as depending upon the number of children to pause, the delay could be quite significant.

Only other way would be to extend MovieClip and keep a Boolean state, but this is a lot of authoring work and defeats the purpose of writing this general functionality.

Ideas anyone?? Did you have any breakthroughs?

]]>
By: kumaravelu http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-10942 Sat, 10 Sep 2011 06:51:13 +0000 http://www.unfocus.com/?p=362#comment-10942 hai,

I need script for Timer and following buttons.

1) Single button for timer ON/OFF/Display timer
2) Reset

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-9770 Wed, 10 Aug 2011 19:41:56 +0000 http://www.unfocus.com/?p=362#comment-9770 In reply to bass.

That depends on how the clip “mc_mc” is scripted. If it’s just a MovieClip (even with nested playing MovieClips), this script should work. Just call stopAll(root.mc_mc) (assuming it’s an AS3 timeline). If it’s just one playing MovieClip, with nothing nested, the normal stop() method should be sufficient. You may need to cast – this a is difficult concept for some users new to AS3 – (root.mc_mc as MovieClip).stop();

]]>
By: bass http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-9435 Sun, 31 Jul 2011 17:46:18 +0000 http://www.unfocus.com/?p=362#comment-9435 Hi,
Thank very much you for this script.
I just have a question for my personal example:
on the main timeline i have only one Frame that contains a Movie Clip named “mc_mc” with an loop animation in it. So i would like to stop it, when it loaded to a player with the stop function. How i can use your script in relation to this case? Thank you very much in advice for the answer.

]]>
By: ian http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-2307 Fri, 29 Oct 2010 04:06:02 +0000 http://www.unfocus.com/?p=362#comment-2307 cool!! nice share

]]>
By: Kevin Newman http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-982 Thu, 06 May 2010 16:10:05 +0000 http://www.unfocus.com/?p=362#comment-982 In reply to Tanelly.

Actionscript 2.0 is a whole different thing. I found this in actionscript.org forums, it might work (untested):

stopMovies(_root);
function stopMovies(mov:MovieClip) {
mov.stop();
for (movs in mov) {
if (typeof mov[movs] == "movieclip") {
mov[movs].stop();
stopMovies(mov[movs]);
}
}
}

]]>
By: Tanelly http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-980 Thu, 06 May 2010 10:50:40 +0000 http://www.unfocus.com/?p=362#comment-980 Hi, if i want make the this in actionscript 2.0 ?

]]>
By: Paul L http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-762 Fri, 19 Feb 2010 20:25:17 +0000 http://www.unfocus.com/?p=362#comment-762 Thank you so much, Kevin. This solution really helped me out.

]]>
By: CuriousFind » Blog Archive » Ultimate Reset of a Loaded AS3 MovieClip http://www.unfocus.com/2009/12/07/stop-all-child-movieclips-in-flash-with-actionscript-3-0/comment-page-1/#comment-714 Wed, 27 Jan 2010 05:16:12 +0000 http://www.unfocus.com/?p=362#comment-714 […] google search landed me here before writing my […]

]]>