<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: A Closer Look: Using MovieClip.addFrameScript()</title>
	<atom:link href="http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/</link>
	<description>OOP Techniques for Flash and Flex Developers</description>
	<lastBuildDate>Sat, 28 Aug 2010 21:46:42 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-5426</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Sat, 28 Aug 2010 21:46:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-5426</guid>
		<description>Hi Otavio,

Yes, you want to clear the code from your timeline. That is the point. It&#039;s bad enough having timeline code all over the place and playing &quot;Where&#039;s Waldo?&quot; with your code. To have a combination of both code in a class (or a design pattern) and on the timeline is a nightmare.

Remember—now there&#039;s no reason to have code on the timeline. Ever.

Kindest regards,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Otavio,</p>
<p>Yes, you want to clear the code from your timeline. That is the point. It&#8217;s bad enough having timeline code all over the place and playing &#8220;Where&#8217;s Waldo?&#8221; with your code. To have a combination of both code in a class (or a design pattern) and on the timeline is a nightmare.</p>
<p>Remember—now there&#8217;s no reason to have code on the timeline. Ever.</p>
<p>Kindest regards,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otavio Silva</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-5423</link>
		<dc:creator>Otavio Silva</dc:creator>
		<pubDate>Thu, 26 Aug 2010 20:31:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-5423</guid>
		<description>Nice post, but one thing needs to be said! 

Lets say you have some code on your timeline, for example a stop(); function call, and then after discovering this amazing function ( addFrameScript()) you decide to give it a try. Remember that the timeline code will be completely overwritten! 

So its one or the other, not both!</description>
		<content:encoded><![CDATA[<p>Nice post, but one thing needs to be said! </p>
<p>Lets say you have some code on your timeline, for example a stop(); function call, and then after discovering this amazing function ( addFrameScript()) you decide to give it a try. Remember that the timeline code will be completely overwritten! </p>
<p>So its one or the other, not both!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jloa</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3634</link>
		<dc:creator>Jloa</dc:creator>
		<pubDate>Wed, 09 Dec 2009 22:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3634</guid>
		<description>Hi, David!
Do you happen 2 know if there are any other undocumented function like the one u described?</description>
		<content:encoded><![CDATA[<p>Hi, David!<br />
Do you happen 2 know if there are any other undocumented function like the one u described?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3043</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Thu, 24 Sep 2009 14:34:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3043</guid>
		<description>Hi Bill and Chandima,

Thanks for the tip about the playhead.  I figured out how to use addFrameScript() with an event dispatch and thus avoid having a script on the timeline, and it certainly is cool!  I made a little app that has 3 colored balls moving across the stage.  When the red one gets to the end of its timeline, it triggers the green one etc.  Here&#039;s the URL:  http://bitsong.com/forPosting/dispatchTest/dispatchTest.html

Here&#039;s some of my code:  I include Main.as and one of the colored ball classes, RedBallContainer.as  Your blog is a great place to get exciting new ideas!  Thanks.

Barbara
&lt;pre lang=&quot;actionscript3&quot;&gt;
package{
	import flash.display.MovieClip;
	import flash.events.Event;
	
	public class Main extends MovieClip{
		public function Main(){
			redBallContainer.stop();
			greenBallContainer.stop();
			blueBallContainer.stop();
			
			redBallContainer.gotoAndPlay(2); // starts everything rolling
			
			stage.addEventListener(&quot;startRed&quot;, onStartRed); // listener for function called when playhead reaches frame 60
			stage.addEventListener(&quot;startGreen&quot;, onStartGreen);
			stage.addEventListener(&quot;startBlue&quot;, onStartBlue);
		}
		
		private function onStartRed(event:Event){
			redBallContainer.gotoAndPlay(2); 
			trace(&quot;start red&quot;);
		}
		private function onStartGreen(event:Event){
			greenBallContainer.gotoAndPlay(2);
			trace(&quot;start green&quot;);
		}
		private function onStartBlue(event:Event){
			blueBallContainer.gotoAndPlay(2);
			trace(&quot;start blue&quot;);
		}
	}
}
&lt;/pre&gt;
&lt;pre lang=&quot;actionscript3&quot;&gt;
package{
	import flash.display.MovieClip;
	import flash.events.Event;
	
	public class RedBallContainer extends MovieClip{
		public function RedBallContainer(){
			this.addFrameScript(59, stopRedStartGreen) // this is instead of having to call stopRedStartGreen() 
													   // from frame 60 of RedBallContainer timeline
		}
		public function stopRedStartGreen(){ // called using addFrameStript above
			this.gotoAndStop(60); // stops red ball movement on frame 60
			dispatchEvent(new Event(&quot;startGreen&quot;, true)); // dispatches event to start green ball 
		}
	}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Bill and Chandima,</p>
<p>Thanks for the tip about the playhead.  I figured out how to use addFrameScript() with an event dispatch and thus avoid having a script on the timeline, and it certainly is cool!  I made a little app that has 3 colored balls moving across the stage.  When the red one gets to the end of its timeline, it triggers the green one etc.  Here&#8217;s the URL:  <a href="http://bitsong.com/forPosting/dispatchTest/dispatchTest.html" rel="nofollow">http://bitsong.com/forPosting/dispatchTest/dispatchTest.html</a></p>
<p>Here&#8217;s some of my code:  I include Main.as and one of the colored ball classes, RedBallContainer.as  Your blog is a great place to get exciting new ideas!  Thanks.</p>
<p>Barbara</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1789code1'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p17891"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p1789code1"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span><span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			redBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			greenBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			blueBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			redBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// starts everything rolling</span>
&nbsp;
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;startRed&quot;</span><span style="color: #000066; font-weight: bold;">,</span> onStartRed<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// listener for function called when playhead reaches frame 60</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;startGreen&quot;</span><span style="color: #000066; font-weight: bold;">,</span> onStartGreen<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;startBlue&quot;</span><span style="color: #000066; font-weight: bold;">,</span> onStartBlue<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onStartRed<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			redBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;start red&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onStartGreen<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			greenBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;start green&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onStartBlue<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			blueBallContainer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndPlay</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;start blue&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1789code2'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p17892"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p1789code2"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span><span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> RedBallContainer <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> RedBallContainer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>addFrameScript<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">59</span><span style="color: #000066; font-weight: bold;">,</span> stopRedStartGreen<span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// this is instead of having to call stopRedStartGreen() </span>
													   <span style="color: #009900; font-style: italic;">// from frame 60 of RedBallContainer timeline</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> stopRedStartGreen<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span> <span style="color: #009900; font-style: italic;">// called using addFrameStript above</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">60</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// stops red ball movement on frame 60</span>
			<span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;startGreen&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #009900; font-style: italic;">// dispatches event to start green ball </span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: William B. Sanders</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3037</link>
		<dc:creator>William B. Sanders</dc:creator>
		<pubDate>Wed, 23 Sep 2009 20:54:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3037</guid>
		<description>Hi David &amp; Barbara,

@David--I couldn&#039;t improve on Chandima&#039;s comment except to add when when using variables you&#039;d want to change the constants to variables. Like you, I&#039;ve only recently learned of this method even though it&#039;s been out for a few years.

@Barbara--Essentially, the MC playhead is acting like a trigger. As soon as it hits the frame, the function is going to be called and it doesn&#039;t matter what you put in the function. I can imagine an endless number of scenarios for this method.

Kindest regards,
Bill</description>
		<content:encoded><![CDATA[<p>Hi David &#038; Barbara,</p>
<p>@David&#8211;I couldn&#8217;t improve on Chandima&#8217;s comment except to add when when using variables you&#8217;d want to change the constants to variables. Like you, I&#8217;ve only recently learned of this method even though it&#8217;s been out for a few years.</p>
<p>@Barbara&#8211;Essentially, the MC playhead is acting like a trigger. As soon as it hits the frame, the function is going to be called and it doesn&#8217;t matter what you put in the function. I can imagine an endless number of scenarios for this method.</p>
<p>Kindest regards,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandima Cumaranatunge</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3036</link>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
		<pubDate>Wed, 23 Sep 2009 18:58:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3036</guid>
		<description>Hi David, You can do the following if you know that certain labels exist in a movie clip. 

The following class extends an MC on the stage that has two labels called &#039;start&#039; and &#039;end&#039; on the tween.

&lt;pre lang=&quot;actionscript&quot;&gt;
package
{
    import flash.display.MovieClip;
    import flash.display.FrameLabel;
    
    public class MyMovieclip extends MovieClip
    {
        private var labels:Object
        
        public function MyMovieclip()
        {
            labels = this.currentLabels;
            
            for ( var i:uint = 0; i &lt; labels.length; i++ )
            {
                var framelabel:FrameLabel = labels[i];
                labels[ framelabel.name ] = framelabel.frame
            }
            
            addFrameScript( labels[&#039;start&#039;], onStartAnim, labels[&#039;end&#039;] - 1, onEndAnim );
        }
        
        public function onStartAnim():void 
        {
            trace(&#039;starting animation&#039;);
        }
        
        public function onEndAnim():void 
        {
            trace(&#039;ending animation&#039;);
        }
    }
}
&lt;/pre&gt;

Now you can safely modify the tween lengths etc. knowing that the code references the labels and not explicit frame numbers.</description>
		<content:encoded><![CDATA[<p>Hi David, You can do the following if you know that certain labels exist in a movie clip. </p>
<p>The following class extends an MC on the stage that has two labels called &#8217;start&#8217; and &#8216;end&#8217; on the tween.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1789code3'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p17893"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p1789code3"><pre class="actionscript" style="font-family:monospace;">package
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
    <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">FrameLabel</span>;
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyMovieclip <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> labels:<span style="color: #0066CC;">Object</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyMovieclip<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            labels = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">currentLabels</span>;
&nbsp;
            <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:uint = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> labels.<span style="color: #0066CC;">length</span>; i++ <span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">var</span> framelabel:FrameLabel = labels<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>;
                labels<span style="color: #66cc66;">&#91;</span> framelabel.<span style="color: #0066CC;">name</span> <span style="color: #66cc66;">&#93;</span> = framelabel.<span style="color: #006600;">frame</span>
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            addFrameScript<span style="color: #66cc66;">&#40;</span> labels<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'start'</span><span style="color: #66cc66;">&#93;</span>, onStartAnim, labels<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'end'</span><span style="color: #66cc66;">&#93;</span> - <span style="color: #cc66cc;">1</span>, onEndAnim <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onStartAnim<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'starting animation'</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onEndAnim<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'ending animation'</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Now you can safely modify the tween lengths etc. knowing that the code references the labels and not explicit frame numbers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barbara Parkman</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3035</link>
		<dc:creator>Barbara Parkman</dc:creator>
		<pubDate>Wed, 23 Sep 2009 15:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3035</guid>
		<description>My own project is going to be very dependent on being able to make things happen like this.  I haven&#039;t tried to write the code yet, but I was assuming I could make the code finish playing an animation and then jump to a function using event dispatches.  Is this not the case?  Thanks.

Barbara</description>
		<content:encoded><![CDATA[<p>My own project is going to be very dependent on being able to make things happen like this.  I haven&#8217;t tried to write the code yet, but I was assuming I could make the code finish playing an animation and then jump to a function using event dispatches.  Is this not the case?  Thanks.</p>
<p>Barbara</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wilhelm</title>
		<link>http://www.as3dp.com/2009/09/23/a-closer-look-using-movieclipaddframescript/comment-page-1/#comment-3034</link>
		<dc:creator>David Wilhelm</dc:creator>
		<pubDate>Wed, 23 Sep 2009 13:44:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=1789#comment-3034</guid>
		<description>Thanks for explaining this cool feature which I had no idea existed. I can see it being very useful when dealing with animated MovieClip assets ... eg. a game where you want to know when the player&#039;s ship has finished blowing up. The one thing that seems awkward is having to reference the exact frame number.. wish there was a way to use a frame label instead.</description>
		<content:encoded><![CDATA[<p>Thanks for explaining this cool feature which I had no idea existed. I can see it being very useful when dealing with animated MovieClip assets &#8230; eg. a game where you want to know when the player&#8217;s ship has finished blowing up. The one thing that seems awkward is having to reference the exact frame number.. wish there was a way to use a frame label instead.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
