<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UnDeprived &#187; Actionscripts</title>
	<atom:link href="http://www.un-deprived.com/tag/actionscripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.un-deprived.com</link>
	<description>A webdev journal of the Moninator</description>
	<lastBuildDate>Sun, 05 Feb 2012 11:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using Actionscript 2.0 to pause frames</title>
		<link>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/</link>
		<comments>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 15:29:03 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[Actionscripts]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[movie clips]]></category>
		<category><![CDATA[pause]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=244</guid>
		<description><![CDATA[…and controls to pause and play the time line. I’ve been using this script quite a bit, and I think it’s time to jog it down somewhere. A few things to keep in mind when using this script: Try not to use this script on the main/root time line. If you have movie clips within [...]]]></description>
			<content:encoded><![CDATA[<p>…and controls to pause and play the time line.</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/08/thumb.jpg" rel="lightbox[244]" title="thumb"><img class="alignnone size-medium wp-image-246" title="thumb" src="http://www.un-deprived.com/wp-content/uploads/2009/08/thumb-301x125.jpg" alt="thumb" width="301" height="125" /></a></p>
<p>I’ve been using this script quite a bit, and I think it’s time to jog it down somewhere. A few things to keep in mind when using this script:<span id="more-244"></span></p>
<ol>
<li>Try not to use this script on the main/root time line. If you have movie clips within the main timeline, when the timer is up, it speeds through the entire time line to the every end. Stop(); won’t do anything.</li>
<li>This script works well inside a movie clip, also works for movie clips within a movie clip. But try to minimize it to only one clip</li>
<li>The controls (Pause, Play) buttons work best in the main / root time line, doesn’t work too well if there are clips within a clip</li>
</ol>
<p>Just insert the following inside a <em>movie clip’s time line</em> where you want it to pauses for a few moments:</p>
<pre>	 stop();

    var startTime:Number = getTimer();
    var pausedTime = 0;
    //countTo = number of seconds.
    var countTo:Number = 10;
    var ref:MovieClip = this;

    this.onEnterFrame = function():Void {
        if (!paused) {
            var elapsedTime:Number = getTimer()-ref.startTime-pausedTime;
            var count:Number = Math.ceil(countTo-(elapsedTime*0.001));
            if(count&lt;1){
                this.gotoAndPlay(nextFrame());
            }
        }
    }</pre>
<p>In addition if you want to have Pause / Play buttons, insert the following codes after the above codes:</p>
<pre>	_root.puz1.onRelease = function() {
       if (!paused) {
          pauseTime = getTimer();
          paused=true;
          _root.puz1.gotoAndStop(2);
       }
    }
    _root.play1.onRelease = function() {
       if (paused) {
          pausedTime += getTimer() - pauseTime;
          paused=false;
          _root.puz1.gotoAndStop(1);
       }
    }</pre>
<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/08/timeline.jpg" rel="lightbox[244]" title="timeline"><img class="alignnone size-medium wp-image-248" title="timeline" src="http://www.un-deprived.com/wp-content/uploads/2009/08/timeline-151x125.jpg" alt="timeline" width="151" height="125" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

