<?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>KeanHui™  - Bookmark Creative Resources and Inspirations &#187; ActionScript</title>
	<atom:link href="http://www.keanhui.com/archives/tag/actionscript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.keanhui.com</link>
	<description>This site will talks about general Art &#38; Design, Web Design, Freebies, Resources and Inspiration.</description>
	<lastBuildDate>Sun, 30 May 2010 04:04:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Flash AS3 to call methods of The MovieClip Class</title>
		<link>http://www.keanhui.com/archives/678</link>
		<comments>http://www.keanhui.com/archives/678#comments</comments>
		<pubDate>Thu, 14 May 2009 15:21:34 +0000</pubDate>
		<dc:creator>keanhui</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.keanhui.com/?p=678</guid>
		<description><![CDATA[
Working with Fuctions and Methods &#124; Using AS3 to call methods of The MovieClip Class
1. Begin a new Flash file
2. Rename Layer 1 to Circle.
3. Draw a circle that is roughly 50&#215;50 pixels at the top-left corner of the stage using the Oval tool from the Tool palette.
4. Select the circle and convert it to [...]


Related posts:<ol><li><a href='http://www.keanhui.com/archives/885' rel='bookmark' title='Permanent Link: FlippingBook Flash Component'>FlippingBook Flash Component</a></li>
<li><a href='http://www.keanhui.com/archives/873' rel='bookmark' title='Permanent Link: Flash Components &#8211; Jumpeye (Full Package)'>Flash Components &#8211; Jumpeye (Full Package)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img title="Using AS3 to call methods of The MovieClip Class" src="http://www.keanhui.com/image/140509/fl_banner.jpg" alt="" width="430" height="153" /></p>
<p><strong>Working with Fuctions and Methods | Using AS3 to call methods of The MovieClip Class</strong><span id="more-678"></span></p>
<p>1. Begin a new Flash file</p>
<p>2. Rename Layer 1 to Circle.</p>
<p>3. Draw a circle that is roughly <strong>50&#215;50 pixel</strong>s at the top-left corner of the stage using the Oval tool from the Tool palette.</p>
<p>4. Select the circle and convert it to a MovieClip symbol named <strong>mcCircle</strong> (<strong>Figure 3.1</strong>).</p>
<p><img class="alignnone" src="http://www.keanhui.com/image/140509/01.jpg" alt="" width="430" height="140" /><br />
<em>( <strong>Figure 3.1</strong>: Convert the circle shape to a MovieClip named <strong>mcCircle</strong> )</em></p>
<p>5. Select the <strong>mcCircle</strong> symbol on the stage and give it an instance name of <strong>mcCircle</strong> in the Properties panel (<strong>Figure 3.2</strong>).</p>
<p><img class="alignnone" src="http://www.keanhui.com/image/140509/02.jpg" alt="" width="430" height="140" /><br />
<em>(<strong>Figure 3.2</strong> : Assign the circle an instance name of Circle )</em></p>
<p>6. Double-click <strong>mcCircle</strong> on the stage to enter its timeline.</p>
<p>7. Select the circle shape and convert it to a Graphic symbol called <strong>Circle</strong>.</p>
<p>8. Insert a new keyframe at <strong>frame 10</strong> and drag the circle graphic instance to the right<br />
side of the stage.</p>
<p>9. Insert a keyframe at <strong>frame 20</strong> and drag the Circle graphic instance back to the left side of the stage<br />
(<strong>x 0 , y 0</strong>).</p>
<p>10. Select the keyframe at frame 1 and select Motion from the Tween type drop-down menu in Properties panel (<strong>Figure 3.3</strong>). Repeat this step for frame 10.</p>
<p><img class="alignnone" src="http://www.keanhui.com/image/140509/03.jpg" alt="" width="430" height="161" /><br />
<em>(<strong>Figure 3.3</strong> : Select the Motion tween type for the keyframe to tween the circle from frame 1 to frame 19 abd frin frane 19 to frame 20.)</em></p>
<p>11.Preview your movie; you should see the Circle moving back and forth across the stage.</p>
<p>12. To stop the timeline of <strong>mcCircle</strong> on the first frame, add a new layer named Actions. Select the first keyframe on the Actions layer and open the Actions panel (by choosing Window &gt; Actions).</p>
<p>13. Add the following <strong>stop()</strong> method to stop the timeline of <strong>mcCircle</strong> at frame1: <strong>stop()</strong>;</p>
<p>14. Return to the main timeline by clicking Scene 1 at the top left of the stage.</p>
<p>15.Create a new layer named Actions on the main timeline. Select the first keyframe on the Action layer and open the Actions panel.</p>
<p>16.Call the instance name <strong>mcCircle </strong>followed by its <strong>gotoAndPlay(0)</strong> method to tell the timeline of <strong>mcCircle</strong> to play frame <strong>frame 2</strong>:<br />
<strong>mcCircle.gotoAndPlay(2);</strong></p>
<p>17. Preview you movie. You should see <strong>mcCircle</strong> begin to play from frame 2 and the stop once it returns to frame 1 in its timeline, where it had been commanded to stop again by the <strong>stop(</strong>) method.18. Call the <strong>gotoAndStop()</strong> method to tell <strong>mcCircle</strong> to go to and stop at a particular frame. The following code tells <strong>mcCircle</strong> to go to and stop at frame number 10:<br />
<strong>mcCricle.gotoAndPlay(10);</strong></p>
<p>19. Preview you movie. You should see the Circle stopped at the right side of the stage.</p>
<h3>Tips</h3>
<p>In Flash, when a timeline animation reaches its last frame, the playhead will return to frame 1 and continue looping unless Action Script tells it otherwise.</p>
<p>We will continue to work with methods of different class as we move throught this book. Althought there are all softs of different methonds, the dot syntas we just used to call methods of the MovieClip class is the same for calling all methods of all objects of classes.</p>
<p><a href="http://www.box.net/shared/bca0aknqoh"><img class="alignnone" src="http://www.keanhui.com/image/download_fla.jpg" alt="" width="181" height="37" /></a></p>


<p>Related posts:<ol><li><a href='http://www.keanhui.com/archives/885' rel='bookmark' title='Permanent Link: FlippingBook Flash Component'>FlippingBook Flash Component</a></li>
<li><a href='http://www.keanhui.com/archives/873' rel='bookmark' title='Permanent Link: Flash Components &#8211; Jumpeye (Full Package)'>Flash Components &#8211; Jumpeye (Full Package)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.keanhui.com/archives/678/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
