<?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"
	>

<channel>
	<title>mikestickney.com</title>
	<atom:link href="http://mikestickney.com/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikestickney.com/wordpress</link>
	<description></description>
	<pubDate>Fri, 01 Aug 2008 15:25:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Thank you K!</title>
		<link>http://mikestickney.com/wordpress/thank-you-k/</link>
		<comments>http://mikestickney.com/wordpress/thank-you-k/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 13:05:37 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Mike's Opinions]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=38</guid>
		<description><![CDATA[I&#8217;ve written close to 20 Flash tutorials so far, and I really enjoy writing them. I try to explain things clearly, and hope that the readers understand them and can easily complete the tutorial, and learn something in the process. I like that I can teach something to people around the world and whom I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written close to 20 Flash tutorials so far, and I really enjoy writing them. I try to explain things clearly, and hope that the readers understand them and can easily complete the tutorial, and learn something in the process. I like that I can teach something to people around the world and whom I&#8217;ve never even met.</p>
<p><span id="more-38"></span></p>
<p>Of course, not everyone gets through these tutorials without problems. I understand, it&#8217;s expected. I don&#8217;t fell that my tutorials are bad because some people have problems, and I don&#8217;t think people who have difficulties with the tutorial don&#8217;t know what they are doing. People learn differently and comprehend things differently, so not everyone gets through these tutorials without a hitch.</p>
<p>I get plenty of questions and comments when people are having problems with any of my Flash tutorials. And I absolutely welcome all questions and comments (good or bad). I try very hard to help users and answer any questions they may have. I&#8217;ve had several back and forth emails with different readers who have had questions, and hopefully have helped them solve the problems. Unfortunately, I&#8217;m not always able to answer questions for several reasons&#8230; sometimes I just don&#8217;t have the time, sometimes the reader didn&#8217;t provide enough info, sometimes the question is well beyond the scope of the tutorial&#8230; but no matter whether I can answer the question or not, I appreciate people asking. It let&#8217;s me know that people are reading them, which is very gratifying.</p>
<p>Recently, a reader was trying to apply one of my tutorials to a real world project, and was struggling to get it to do exactly what she needed. We&#8217;ve been communicating through email for several weeks now, and while we haven&#8217;t quite gotten to the desired result just yet, I think we will. As appreciation for my help, she has made a monetary donation to the site. While it wasn&#8217;t expected, and no dollar value was asked of her, it was very appreciated. She simply gave an amount that she thought was right, and I happily accepted. So, for that I would like to publicly say &#8220;thank you K (aka Lou in the comment string).&#8221;</p>
<p>Her donation will help keep this site running so that more tutorials can be written and hopefully help others learn Flash. I know it&#8217;s been a while since I&#8217;ve written a new Flash tutorial, but the readers have actually given me several new ideas, I just need to find the time to write them. Keep those questions and comments coming, and I&#8217;ll try my best to keep writing new tutorials.</p>
<p>-Mike</p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/thank-you-k/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Flash Tutorial Site</title>
		<link>http://mikestickney.com/wordpress/new-flash-tutorial-site/</link>
		<comments>http://mikestickney.com/wordpress/new-flash-tutorial-site/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 17:18:49 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Resources]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Mike's Opinions]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[gotoAndLearnFlash]]></category>

		<category><![CDATA[learn flash]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=37</guid>
		<description><![CDATA[I&#8217;ve been working in my (very limited) free time on a new site for Flash tutorials. About a month ago, I did a soft-launch of www.gotoandlearnflash.com.
The goal of gotoAndLearnFlash is to have users find the Flash tutorials they want, and write their own reviews to let future readers of this site know whether the tutorial [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working in my (very limited) free time on a new site for Flash tutorials. About a month ago, I did a soft-launch of <a title="Flash tutorials on gotoAndLearnFlash.com" href="http://www.gotoandlearnflash.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gotoandlearnflash.com');">www.gotoandlearnflash.com</a>.</p>
<p>The goal of <a title="Flash tutorials at gotoandlearnflash.com" href="http://www.gotoandlearnflash.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gotoandlearnflash.com');" target="_blank">gotoAndLearnFlash</a> is to have users find the Flash tutorials they want, and write their own reviews to let future readers of this site know whether the tutorial was really helpful or not. While my goal here is to find the best free online Flash tutorials the net has to offer, I simply don’t have the time to review each and every tutorial I come across. That is why I encourage users to check out the tutorials, come back and rate or review them for future readers.</p>
<p>Currently, there are only a few tutorials listed, but I try to add more and more when I can. The biggest hurdle is I really would like to review any tutorials that I post, but I simply don&#8217;t have the time. So, I&#8217;ve been posting some Flash tutorials without an editorial review in hopes that users will add their own reviews in the comments section. Better than a rating system, I believe a user review will help gauge whether the tutorial is really worth checking out. If you enjoy my tutorials, check out <a title="Flash tutorials at gotoandlearnflash.com" href="http://www.gotoandlearnflash.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gotoandlearnflash.com');" target="_blank">www.gotoandlearn.com</a> to find more Flash tutorials from other authors that I found helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/new-flash-tutorial-site/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Photoshop Videos</title>
		<link>http://mikestickney.com/wordpress/photoshop-videos/</link>
		<comments>http://mikestickney.com/wordpress/photoshop-videos/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 13:03:19 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Photoshop]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[online videos]]></category>

		<category><![CDATA[photoshop tutorials]]></category>

		<category><![CDATA[photoshop videos]]></category>

		<category><![CDATA[video tutorials]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=36</guid>
		<description><![CDATA[I&#8217;ve spent a lot of time talking about Flash on this site, mainly because that&#8217;s where my highest interest is&#8230; however that&#8217;s not the only software we designers need to know. So, I thought I&#8217;d pass along this great list from psdtuts.com of featuring 18 really great Online Photoshop Videos. Some are straight tutorials, some [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent a lot of time talking about Flash on this site, mainly because that&#8217;s where my highest interest is&#8230; however that&#8217;s not the only software we designers need to know. So, I thought I&#8217;d pass along this great list from psdtuts.com of featuring 18 really great <a title="Online Photoshop Videos" href="http://psdtuts.com/web/18-of-the-best-photoshop-videos-online/" onclick="javascript:pageTracker._trackPageview('/outbound/article/psdtuts.com');" target="_blank">Online Photoshop Videos</a>. Some are straight tutorials, some are Photoshop demos, but either way, a nice collection of fun and interesting videos about Photoshop.</p>
<p>If you haven&#8217;t visited <a title="Photoshop Tutorials" href="http://mikestickney.com/wordpress/wp-admin/http:psdtuts.com"  target="_blank">psdtuts.com</a> (and it&#8217;s sister site <a title="Web Development Tutorials" href="http://nettuts.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/nettuts.com');" target="_blank">nettuts.com</a>) I recommend you check it out. They always have some great, high-quality tutorials on Photoshop (while nettuts.com is focused on Web development tutorials).</p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/photoshop-videos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google has improved Flash indexing</title>
		<link>http://mikestickney.com/wordpress/google-has-improved-flash-indexing/</link>
		<comments>http://mikestickney.com/wordpress/google-has-improved-flash-indexing/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 12:36:50 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Resources]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=35</guid>
		<description><![CDATA[Google has announced that they have greatly improved the searching and indexing of Flash files
In the past, web designers faced challenges if they chose to develop a site in Flash because the content they included was not indexable by search engines. They needed to make extra effort to ensure that their content was also presented [...]]]></description>
			<content:encoded><![CDATA[<p>Google has announced that they have greatly improved the searching and indexing of Flash files</p>
<blockquote><p>In the past, web designers faced challenges if they chose to develop a site in Flash because the content they included was not indexable by search engines. They needed to make extra effort to ensure that their content was also presented in another way that search engines could find.</p></blockquote>
<p><span id="more-35"></span><img class="mce_plugin_wordpress_more" title="More..." src="http://172.26.103.70/Portal_Systems/wp/wp-includes/js/tinymce/themes/advanced/images/spacer.gif" alt="More..." width="100%" height="10" /></p>
<p>Thanks in part to Adobe&#8217;s new Searchable SWF library, Google has come up with new algorithms that better search and index Flash (.swf) files.</p>
<p>Basically, Google can now index any textual content in a Flash file (I was under the impression that it could always do that&#8230;). I would imagine this would be text blocks that haven&#8217;t been broken apart, which some designers do to apply animation effects. In other words, say you wanted a headline that came in one letter at a time (like a typewriter)&#8230;. each letter would be a seperate element, thus put together, it reads as a word, but Google would see it as the individual letters.</p>
<p>In addition to text blocks, Google can now track links to other pages. While things like anchor text and title tags cannot be attributed to these links, the fact that Google can now at least REACH these pages through Flash is huge!</p>
<p>Google still cannot index any image elements, or really anything other than text and urls, but this is still a really big step in getting Flash sites indexed (or even having Flash elements on a page support the page content).</p>
<p>Read the <a href="http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/googlewebmastercentral.blogspot.com');">Google Webmasters Q and A about Flash indexing</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/google-has-improved-flash-indexing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Breakout Game Tutorial Part 5</title>
		<link>http://mikestickney.com/wordpress/flash-game-tutorial-part-5/</link>
		<comments>http://mikestickney.com/wordpress/flash-game-tutorial-part-5/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 18:24:05 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash ActionScript tutorial]]></category>

		<category><![CDATA[flash games]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=34</guid>
		<description><![CDATA[Flash Tutorial: Creating a Brick Breaking Paddle Game in Flash: Part 5
Level: This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Creating a Brick Breaking Paddle Game in Flash: Part 5</p>
<p><strong>Level:</strong> This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> The fifth part of a Flash tutorial on making a Flash game similar to the old BreakOut game for Atari. In previous parts, we <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/"  target="_self">created the movement for the paddle and the ball</a>, <a href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/" >set up the bricks and the script for collisions</a>, <a href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >added scores to our Flash game,</a> and in our <a href="http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/" >last tutorial</a>, we set it up to go to a &#8220;You Win&#8221; screen. In this tutorial, we will set up a players &#8220;lives&#8221;, as well as what will happen when the player runs out of lives.</p>
<p><strong>Demo:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mikestickney.com/flash/breakthru_game5.swf" /><embed type="application/x-shockwave-flash" width="300" height="250" src="http://mikestickney.com/flash/breakthru_game5.swf"></embed></object><br />
(Refresh page if you don&#8217;t see the ball animation)</p>
<p><strong>Let&#8217;s get started!</strong></p>
<p>Let&#8217;s open up our Flash files from <a title="Flash Tutorial: Breakthru Flash Game Part 4" href="http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/"  target="_self">Part 4 of this game tutorial</a>. <span id="more-34"></span>While it&#8217;s not necessary, you may want to do a &#8220;Save As&#8221; and give your document a new name (&#8221;breakthru_game5.fla&#8221;). The reason you may want to do this is it might make it easier to review each part of the Flash tutorial later.</p>
<p>In our <a href="http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/" >last tutorial</a>, we set our Flash game to go to a new frame when the player &#8220;wins&#8221; the game (or clears the board). Now, we want our Flash movie to change if the player &#8220;loses&#8221; the game. By &#8220;losing&#8221; the game, we simply mean the player has run out of &#8220;lives&#8221; (or balls). So, the first thing we need to do is set up some new text boxes to display our players lives. This is done similarly to how we set up the score text in <a href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >Part 3 of this Flash tutorial</a> series. In fact, to get started, we are going to do a copy/paste of the text we set up.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Click on frame 1 of our main timeline (Scene 1), and be sure your &#8220;score text&#8221; label is not locked. On the stage, select both the static text box (where it says &#8220;Score&#8221;) and the dynamic text box (the box with the dotted line around it) (Fig. 1). Tip: It may be easier to select these if you lock all the other layers except your &#8220;score text&#8221; layer.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut15_fig1.gif" alt="Flash Game Tutorial Fig. 1" /></p>
<p>Choose &#8220;Edit &gt; Copy&#8221; (command-C) to add these items to the clipboard. Add a new layer above your &#8220;score text&#8221; layer and name your new layer &#8220;Player lives&#8221;. Click on frame 1 of your new layer and choose &#8220;Edit &gt; Paste&#8221; (command-V) to paste a copy of your text boxed to the stage. Position these boxes at the bottom right corner of the stage, aligned with your score text boxes. Double click on the &#8220;Score&#8221; text on the right side of the stage, and type the word &#8220;Lives&#8221;. Now, click on the dynamic text box next to the &#8220;Lives&#8221; text and in the Properties Panel (&#8221;Window &gt; Properties &gt; Properties&#8221; or command-F3) change the &#8220;var&#8221; text field to say &#8220;lives&#8221; (Fig 2). Last step is to click on frame 2 of our &#8220;Player Lives&#8221; layer, and right-click (option-click) and choose &#8220;Remove Frames&#8221; from the menu flyout.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut15_fig2.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>We now have our Player Lives text boxes ready, so now we have to add the code that will dynamically change when our paddle (player) misses the ball (player life). On our main timeline, click on frame 1 of the &#8220;actions&#8221; layer, open the Actions Panel (Windows &gt; Actions or alt-F9) and add the following code below the existing code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">var lives = 5;</span></p>
<p>This, as you probably could guess, sets our dynamic text box with the var name of &#8220;lives&#8221; to display he number 5, where 5 is the number of chances the player has to drop the ball before losing the game.</p>
<p>Now that we assigned a number of player lives, we need to add some script that tells Flash to take away a life when the player misses the ball. On our stage, select the white circle (ball). You&#8217;ll remember in <a href="http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/" >Part 1 of our Flash game tutorial</a> we set added some script that reset our ball if the player missed the ball. In that same section of code (the <span style="color: #000080;">if</span> statement towards the bottom), we need to add some additional code to tell Flash to deduct a number from our &#8220;Lives&#8221; text box. Add the <span style="color: #000080;"><strong>bold, blue code </strong></span>below to your existing code (<span style="color: #008000;">green</span> code should have been added in part 1):</p>
<p style="padding-left: 30px;"><span style="color: #008000;">if (this._y &gt; 300) {<br />
<span style="color: #000080;"><strong>_root.lives -= 1;<br />
if (_root.lives == 0) {<br />
_root.play();<br />
}</strong></span><br />
_x = 150;<br />
_y = 100;</span></p>
<p>dir = Math.round(Math.random() * 1);<br />
speed = 10;<br />
if (dir == 1) {<br />
var Ang = 45;<br />
} else {<br />
var Ang = 135;<br />
}<br />
xspeed = speed * Math.cos((Ang) * Math.PI / 180);<br />
yspeed = speed * Math.sin((Ang) * Math.PI / 180);<br />
}<br />
}</p>
<p>Explanation of the new code:</p>
<p style="padding-left: 30px;"><span style="color: #008000;">if (this._y &gt; 300) {</span><br />
<span style="color: #008000;"><span style="color: #000080;">_root.lives -= 1<strong>;</strong></span></span></p>
<p>If our ball y coordinate is greater than 300 (goes below the paddle), subtract our &#8220;lives&#8221; by 1.</p>
<p style="padding-left: 30px;"><span style="color: #008000;"><span style="color: #000080;">if (_root.lives == 0) {<br />
_root.play();<br />
}</span></span></p>
<p>If our &#8220;lives&#8221; is equal to 0 (meaning we have no lives left), then play our main timeline.</p>
<p>Go ahead and test your movie. On start, you should see that you have &#8220;5&#8243; lives. Each time you miss a ball, you should see your lives go down by 1 number. If your lives goes all the way to 0, you should see frame 2 of your main timeline come up&#8230; but wait, it still says &#8220;You Win&#8230;&#8221;. Well, we don&#8217;t want it to say that unless we clear the board, so we need to make it say something other than that if we lose, right? Well, luckily Flash makes it pretty easy to do that.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Click on frame 2 of the &#8220;You Win&#8221; layer in your Flash file. Select the &#8220;Congratulations&#8230;&#8221; text box, and in the properties panel, change the drop down to &#8220;Dynamic Text&#8221; and in the &#8220;Var&#8221; text field give it the name &#8220;gameOver&#8221;. You&#8217;ll notice that when you change the text box to &#8220;Dynamic Text&#8221;, the actual text in your box did not change. That&#8217;s because you can input text to a dynamic text box in Flash and have it display in your movie, but because it&#8217;s &#8220;dynamic&#8221; you can modify it using ActionScript code. So, since if the player wins, we want this text to read &#8220;Congratulations&#8230;&#8221; we will leave this. But, if the Player loses, we need it to say something else. We&#8217;ll add that code now.</p>
<p>Click on frame 2 of your &#8220;actions&#8221; layer, open your Actions Panel and add the following code below the existing code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if (_root.lives == 0) {<br />
gameOver = &#8220;&lt;p align=&#8217;center&#8217;&gt;Sorry, you lose! &lt;br&gt;&lt;br&gt;Your Final Score Is:&lt;/p&gt;&#8221;;<br />
}</span></p>
<p>What this says is if our player lives is equal to zero, our dynamic text box should insert the text between the quotation marks. But hold on a minute&#8230; what&#8217;s with all the extra text here? Well, if your familiar with HTML code, you should recognize this as HTML markup language. That&#8217;s right, Flash can render HTML text in a dynamic text field! But, for this to happen, we need to tell our text box to render HTML code.</p>
<p>Click on frame 2 of the &#8220;You Win&#8221; layer, and select the top dynamic text box. In the Properties Panel, click on the &#8220;Render Text as HTML&#8221; button (the button with the angle brackets (&lt;&gt;) on it (Fig 3).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut15_fig3.gif" alt="Flash Game Tutorial Fig. 3" /></p>
<p>That&#8217;s it! I must say our game is looking pretty good right now, don&#8217;t you agree? We have our basic challenge of bouncing a ball into multiple bricks, we can keep score, and now we only have a certain amount of chances in order to accomplish our goal. Pretty cool. While this game seems pretty complete, there&#8217;s so much more we can do to this game, including adding a start screen, adding additional levels and making different skill levels. Study up on these tutorials, and hopefully you can figure out how to do some of these things yourself, but if not, check back soon as I plan to cover all of these steps in future tutorials!</p>
<p>Thanks for reading, and I hope you were able to follow along and create your own Flash game, and I also hope that they have given you a nice little primer for Flash game development. Good luck and don&#8217;t forget to check back soon to expand on our Flash Breakout Game!</p>
<p><strong>Source files (Flash 8):</strong> <a title="Flash Tutorial: Breakthru Flash Game Part 2" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game4.fla" >Flash Tutorial: Breakthru Flash Game Part 4</a><a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game.fla"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/flash-game-tutorial-part-5/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Breakout Game Part 4</title>
		<link>http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/</link>
		<comments>http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 23:36:05 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash ActionScript tutorial]]></category>

		<category><![CDATA[flash games]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=33</guid>
		<description><![CDATA[Flash Tutorial: Creating a Brick Breaking Paddle Game in Flash: Part4
Level: This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with earlier [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Creating a Brick Breaking Paddle Game in Flash: Part4</p>
<p><strong>Level:</strong> This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> The fourth part of a Flash tutorial on making a Flash game similar to the old BreakOut game for Atari. In the <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/"  target="_self">first part of our game tutorial</a>, we created the movement for the paddle and the ball. In the <a href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/" >second part of the Flash tutorial</a>, we set up the bricks and applied the script for the collisions of the ball with the bricks. In the <a href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >third part of our Flash game tutorial,</a> we added scores to our flash game. Now, for the fourth part of our Flash game, we will have the game advance to a new screen when we &#8220;win&#8221; the game.</p>
<p><strong>Demo:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mikestickney.com/flash/breakthru_game4.swf" /><embed type="application/x-shockwave-flash" width="300" height="250" src="http://mikestickney.com/flash/breakthru_game4.swf"></embed></object></p>
<p><strong>Let&#8217;s get started!</strong></p>
<p>Let&#8217;s open up our Flash files from <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/"  target="_self">Part 3 of this game tutorial</a>. <span id="more-33"></span>While it&#8217;s not necessary, you may want to do a &#8220;Save As&#8221; and give your document a new name (&#8221;breakthru_game4.fla&#8221;). The reason you may want to do this is it might make it easier to review each part of the Flash tutorial later.</p>
<p>In our <a href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >last tutorial</a>, we added a score using dynamic text to our Flash game. What we want to do now is have the game advance to a new screen when the player &#8220;wins&#8221; the game, or clears the board of the bricks. To do this, we will be advancing the game based on the players score. The first step in order to do this is to add the next &#8220;You Win&#8221; state (or screen) to our Flash file.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>On our movies main timeline (Scene 1), add a new layer called &#8220;You Win&#8221;, and move the layer under the &#8220;actions&#8221; layer. Click on frame 1 of our new layer, and add a blank keyframe (&#8221;Insert &gt; Timeline &gt; Blank Keyframe&#8221; or F6). Because we don&#8217;t want the other layers to be visible on frame 2 of our movie, select the 2 keyframe of all the layers below our &#8220;You Win&#8221; layer, and control-click (right-click) and select &#8220;Remove Frames&#8221; from the flyout menu.</p>
<p>Click on frame 2 of your &#8220;You Win&#8221; layer, select the Text Tool (T), set it to &#8220;Static Text&#8221; in your Properties Panel (&#8221;Window &gt; Properties &gt; Properties&#8221; or command-F3) and click on the stage and  type something like</p>
<p>&#8220;Congratulations! You Win!&#8221; &lt;return&gt;<br />
&#8220;Your Final Score Is:&#8221;</p>
<p>You should now have something similar to Fig. 1.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut14_fig1.gif" alt="Flash Game Tutorial Fig. 1" /></p>
<p>Select the Text Tool (T) again, and draw another text box below this text. In the Properties Panel, set the dropdown to &#8220;Dynamic Text&#8221;, in the &#8220;var&#8221; field give it a name of &#8220;scoreFinal&#8221; and select the &#8220;center align&#8221; paragraph setting (Fig 2).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut14_fig2.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>Remember that in our previous tutorial, we added a <span style="color: #000080;">stop();</span> action to frame 1 of our &#8220;actions&#8221; layer in our main timeline. So, if we were to test our movie now, we would still only be able to play our game and we would never see the &#8220;You Win&#8221; frame. So, what we need to do now is add some script that tells our Flash movie to advance to the next frame IF our score equals the &#8220;winning score&#8221;.</p>
<p>Open the Library window (&#8221;Window &gt; Library&#8221; or command-L). Double click on your &#8220;mc_Brick&#8221; symbol in the library to bring up symbol editing mode. Click on frame 2 of the actions layer, open the Actions Panel (&#8221;Window &gt; Actions&#8221; or alt-F9) and add the following code under the existing code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if (_root.score == 160) {<br />
_root.play();<br />
}</span></p>
<p>What this is saying is if the dynamic text box on the main timeline with the var name &#8220;score&#8221; (which we set  up in our <a href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >previous tutorial</a>) is equal to 160, than play our main timeline. We use 160 because there are 16 bricks worth 10 points each: 16 x 10 = 160. So, in order for our score to equal 160, all the bricks must be hit by our ball. Once that is done, we advance to the next frame of our main timeline (<span style="color: #000080;">_root</span>), if our score is less than 160, we remain on frame 1 of our main timeline (because of the <span style="color: #000080;">stop();</span> action we already applied).</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Return to Scene 1 of your movie. Click on frame 2 of our &#8220;actions&#8221; layer and add a blank keyframe. With frame 2 still selected, open the actions panel and add the following code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">stop();</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">scoreFinal = score;</span></p>
<p>What this code does is stops our movie on frame 2 and sets our dynamic text box with a var name of &#8220;scoreFinal&#8221; (which we set earlier in this tutorial) to be the same as whatever the text is in our text box with the variable name of &#8220;score&#8221;. Of course you could simply say &#8220;<span style="color: #000080;">scoreFinal = 160</span>&#8220;, since we know that the score is 160 if they hit this frame, but I&#8217;m going to set it dynamically in order to give you a teaser for the next part of this series which is what happens if a player loses. After all, what fun is a game that you ALWAYS win??</p>
<p>For now, go ahead and test your movie. The game should play just like it did at the end of the last tutorial, but now when you have all the bricks cleared, you should see the &#8220;Congratulations&#8230;&#8221; text. Obviously, this &#8220;You Win&#8221; page isn&#8217;t the most exciting thing in the world, so I would hope that you might play around and stylize this on your own.</p>
<p>I hope you enjoyed this tutorial, and hopefully you&#8217;ll come back soon for the next part of the game tutorial. Thanks for reading, and if you have trouble, the commented source file is available below to help you along.</p>
<p>Continue to <a title="Flash Game Tutorial part 5" href="http://mikestickney.com/wordpress/flash-game-tutorial-part-5/" >Part 5 &gt;&gt;</a></p>
<p><strong>Source Files (Flash 8): </strong><a title="Flash Tutorial: Breakthru Flash Game Part 2" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game4.fla" >Flash Tutorial: Breakthru Flash Game Part 4</a><a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game.fla"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Breakout Game Part 3</title>
		<link>http://mikestickney.com/wordpress/flash-tutorial-game-scores/</link>
		<comments>http://mikestickney.com/wordpress/flash-tutorial-game-scores/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 01:09:00 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash ActionScript tutorial]]></category>

		<category><![CDATA[flash games]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=32</guid>
		<description><![CDATA[Flash Tutorial: Creating a Brick Breaking Paddle Game in Flash: Part 3
Level: This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Creating a Brick Breaking Paddle Game in Flash: Part 3</p>
<p><strong>Level:</strong> This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> The third part of a Flash tutorial on making a Flash game similar to the old BreakOut game for Atari. In the <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/category/actions-script-tutorial/"  target="_self">first part of our game tutorial</a>, we created the movement for the paddle and the ball. In the <a href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/" >second part of the Flash tutorial</a>, we set up the bricks and applied the script for the collisions of the ball with the bricks. In this part of our Flash game tutorial, we will set up the game score using dynamic text.</p>
<p><strong>Demo:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mikestickney.com/flash/breakthru_game3.swf" /><embed type="application/x-shockwave-flash" width="300" height="250" src="http://mikestickney.com/flash/breakthru_game3.swf"></embed></object></p>
<p><strong>Let&#8217;s get started!</strong></p>
<p>Let&#8217;s open up our Flash files from <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/"  target="_self">Part 2 of this game tutorial</a>. <span id="more-32"></span>While it&#8217;s not necessary, you may want to do a &#8220;Save As&#8221; and give this your document a new name (&#8221;breakthru_game3.fla&#8221;). The reason you may want to do this is it might make it easier to review each part of the Flash tutorial later.</p>
<p>In our <a href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/" >last tutorial</a>, we added the bricks for us to try and direct the ball into. What now should happen is when the ball hits a brick, that brick will disappear, and the ball will reverse angle and direction. Now, what we want to happen is in addition to the brick disappearing, we want it to add points to our game score.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Since we will be adding our game scores to the bottom of the stage, the first thing we will do is move our paddle up about 25 pixels from the bottom of the stage. Now, lets add a new layer to our timeline under the &#8220;actions&#8221; layer, and name it &#8220;background&#8221;. With the Rectangle Tool (R), draw a rectangle (any color you wish, I&#8217;ve used a purple), with no stroke, approximately 25 pixels tall across the width of your stage (Fig 1).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut13_fig1.gif" alt="Flash Game Tutorial Fig. 1" width="323" height="290" /></p>
<p>Add a new layer above your new rectangle, and label it &#8220;score text&#8221;. Next, select the Text Tool (T), and in the lower left corner of the stage, click on the stage and type &#8220;Score:&#8221; in white letters. Click on the text and in Properties Panel (&#8221;Window &gt; Properties &gt; Properties&#8221; or command-F3) be sure to select &#8220;Static Text&#8221; from the dropdown (Fig 2).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut13_fig2.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>Again, using the Text Tool, draw a rectangle next to your text, and in the Properties Panel select &#8220;Dynamic Text&#8221; from the drop down, and in the &#8220;var&#8221; text field, type the word &#8220;score&#8221; (Fig 3).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut13_fig3.gif" alt="Flash Game Tutorial Fig. 3" /></p>
<p>Here&#8217;s a quick little explanation on &#8220;Dynamic Text&#8221; vs. &#8220;Static Text&#8221;. When we use &#8220;static text&#8221;, whatever we type in the text box will remain exactly what we typed in Flash when we publish the Flash movie. So, for items that we know will never need to change, we can use the &#8220;static text&#8221; option. With &#8220;dynamic text&#8221;, our text can change based on ActionScript that we set in our Flash movie, using the &#8220;var&#8221; name (in this case, &#8220;score&#8221;). There are multiple ways to input and display Dynamic Text fields (including importing from an XML file and even formatting as HTML), however that is way beyond the scope of this tutorial, but I thought a quick explanation of the difference would be appropriate. Tip: A dynamic text box will have a dotted line around it (as long as the layer is unlocked), while a static text field will not have a box (unless it&#8217;s clicked on) (Fig 4). Also, you can add text to a dynamic text box, and what you type will display in Flash when you publish the Flash movie (until we add code to change it&#8230;.)</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut13_fig4.gif" alt="Flash Game Tutorial Fig. 4" /></p>
<p>What we&#8217;ll do now is set our score to be 0 (zero) when the game starts. To do this, on the main timeline, click on frame 1 of your &#8220;actions&#8221; layer, open the Actions Panel, and under the &#8220;stop();&#8221; actions, add the following code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">var score=0;</span></p>
<p>What this code is doing is making our dynamic text box with the var name of &#8220;score&#8221; display a zero when the movie opens.</p>
<p>Now that we have our dynamic score box, we will need to add the code to change our score when we hit the brick. We will be adding this code to our &#8220;mc_Brick&#8221; movie clip. Open the Symbol Library (&#8221;Window &gt; Library&#8221; or command-L). In the Library panel, double click on the &#8220;mc_Brick&#8221; symbol to bring it into symbol editing mode. Click on frame 2 of the &#8220;actions&#8221; layer, open your Actions Panel (Window &gt; Actions or alt-F9), and add the following code under the stop(); action:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root.score += 10;<br />
</span></p>
<p>What this is saying is when we get to this frame, add 10 points to the number in our dynamic text box with a var of &#8220;score&#8221; that we set on our main timeline.</p>
<p>That&#8217;s it! We now can keep score for our Flash game. Pretty simple, huh?</p>
<p>Check back soon for Part 4 of our game tutorial where we will have the game change when we &#8220;win&#8221; (i.e. clear all the bricks) the game.</p>
<p>I hope you enjoyed this tutorial. As always, the source files (with comments) can be found below.</p>
<p>Continue to <a title="Flash Game Tutorial part 4" href="http://mikestickney.com/wordpress/akflash-tutorial-flash-game-development/" >Part 4 &gt;&gt;</a></p>
<p><strong>Source Files (Flash 8): </strong><a title="Flash Tutorial: Breakthru Flash Game Part 2" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game3.fla" >Flash Tutorial: Breakthru Flash Game Part 3</a><a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game.fla"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/flash-tutorial-game-scores/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Breakout Game Part 2</title>
		<link>http://mikestickney.com/wordpress/flash-tutorial-flash-game/</link>
		<comments>http://mikestickney.com/wordpress/flash-tutorial-flash-game/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 23:46:06 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash ActionScript tutorial]]></category>

		<category><![CDATA[flash games]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=31</guid>
		<description><![CDATA[Flash Tutorial: Creating a Brick Breaking Paddle Game in Flash: Part 2
Level: This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Creating a Brick Breaking Paddle Game in Flash: Part 2</p>
<p><strong>Level:</strong> This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> In this tutorial, I will explain the second part of making a game similar to the old BreakOut game for Atari. In the <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/"  target="_self">previous part</a>, we created the movement for the paddle and the ball. In this part, we will set up the bricks and apply the script for the collisions of the ball with the bricks.</p>
<p><strong>Demo:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mikestickney.com/flash/breakthru_game2.swf" /><embed type="application/x-shockwave-flash" width="300" height="250" src="http://mikestickney.com/flash/breakthru_game2.swf"></embed></object></p>
<p><strong>Let&#8217;s get started!</strong></p>
<p>Let&#8217;s open up our Flash files from <a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/"  target="_self">Part 1 of this game tutorial</a>. <span id="more-31"></span>While it&#8217;s not necessary, you may want to do a &#8220;Save As&#8221; and give this your document a new name (&#8221;breakthru_game2.fla&#8221;). The reason you may want to do this is it might make it easier to review each part of the tutorial later.</p>
<p>In our last tutorial, we set up the movement of the ball and the paddle. The ball bounces around the stage, and when it hits either side, or the top of the stage, it reverses angle and direction. The paddle is controlled by the user using the left and right arrow keys, and when the ball hits the paddle, it reverses angle and direction. Pretty neat, but not the most fun game in the world&#8230; so what we will do now is add the bricks for the us to try and direct the ball into. What we want to happen is when the ball hits a brick, that brick will disappear, and the ball will reverse angle and direction.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Obviously, the first thing we need to do is draw our bricks, and set them up in a &#8220;grid&#8221; type alignment similar to Fig. 1 below.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig1.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>You&#8217;ll notice we have 16 different bricks that are 4 different colors. You of course can add as many or as few bricks as you want, but for simplicity I think this is a good number. Because Flash allows us to edit certain aspects of a symbol on the stage, such as color and size, without changing the appearance of our original Library symbol, we will only need to draw our brick symbol once.</p>
<p>Select the Rectangle Tool (R), and choose no stroke (white swatch with a red line through it in the color pallette), and a fill of red (although any color is fine). Draw a rectangle on your stage approximately 75 pixels wide by 10 pixels tall. Select your rectangle using the Selection Tool (V), and choose &#8220;Modify &gt; Convert to Symbol&#8221; (F8), and give your symbol a name of &#8220;mc_brick&#8221; and select the &#8220;Movie Clip&#8221; radial and hit &#8220;Ok&#8221;. With your mc_brick symbol still selected, again choose &#8220;Modify &gt; Convert to Symbol&#8221; (F8), and give your symbol a name of &#8220;mc_brickHolder&#8221; and select the &#8220;Movie Clip radial and hit &#8220;OK&#8221;.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>What you will now have is a nested movie clip (mc_brick is nested within mc_brickHolder) (Fig. 2). The reason we want to nest our &#8220;mc_brick&#8221; symbol inside the &#8220;mc_brickHolder&#8221; movie clip is because all of our bricks on the stage will be using the same ActionScript code. By nesting our brick symbol in a holder mc, we will only need to apply our ActionScript once (within the holder clip). While we could place each &#8220;mc_brick&#8221; symbol on the stage the same way we will the holder, if we did it that way we would need to add the ActionScript to each instance of our brick (16)&#8230; and if we need to trouble shoot, we would be trouble shooting our script 16 times. This way, we only need to add the code once, and if we need to modify the code, we only need to modify it once. I know that explanation might be a little confusing, but hopefully it makes more sense by the time you get to the end of this tutorial.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig2.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>From the Library window (&#8221;Window &gt; Library&#8221; or command-L), click on your &#8220;mc_brick&#8221; symbol to bring it into sybmol editing mode. Add a new layer and label it &#8220;actions&#8221;, and name the layer with your rectangle &#8220;brick&#8221;. In frame 2, add a new keyframe (&#8221;Insert &gt; Timeline &gt; Keyframe&#8221; or F6) to both layers. Select frame 1 of your actions layer, open the Actions Panel (&#8221;Window &gt; Actions&#8221; or alt-F9), and place a stop action here:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">stop();</span></p>
<p>Input another stop action on Frame 2 of the actions layer. On Frame 2 of your brick layer, delete the rectangle from the stage. Your timeline for this symbol should now look similar to Fig. 3 below.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig3.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>Now, from the Library window, click on the &#8220;mc_brickHolder&#8221; symbol to bring it into symbol editing mode. This is where we will be adding the Action Script that controls what will happen when our ball comes into contact with our brick. On the stage, click on the rectangle ONCE (clicking twice will bring you into &#8220;mc_brick&#8221; symbol editing mode, which is what we don&#8217;t want). Tip: if you click on the symbol on the stage once, you will see a blue bounding box around the symbol. If you are in symbol editing mode, clicking on the rectangle will show whitedots within your selection (Fig 4).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig4.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>With our symbol on the stage selected, open the Actions Panel and add the following script:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(enterFrame) {<br />
if ((this.hitTest(_root.ball))) {<br />
_root.ball.yspeed = -_root.ball.yspeed;<br />
this.play();<br />
}<br />
}</span></p>
<p>Here is the code explanation (which relates to the code from Part 1 of this tutorial):</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(enterFrame) {</span></p>
<p>When we get to this frame, perform the code between the curly brackets.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if ((this.hitTest(_root.ball))) {</span></p>
<p>If our ball (&#8221;<span style="color: #000080;">_root.ball</span>&#8220;) moviclip touches (<span style="color: #000080;">&#8220;.hitTest</span>&#8220;) the brick (&#8221;<span style="color: #000080;">this</span>&#8220;), then perform the actions between the curly brackets.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root.ball.yspeed = -_root.ball.yspeed;</span></p>
<p>reverse the angle and direction of the ball (set in Part 1 of this tutorial)</p>
<p style="padding-left: 30px;"><span style="color: #000080;">this.play();<br />
}<br />
}</span></p>
<p>And play the brick movie clip (advancing it to the blank frame of our mc_brick symbol, essentially making our brick disappear).</p>
<p>That&#8217;s all the ActionScript needed for this tutorial. All that&#8217;s left to do now is place our bricks onto the stage.</p>
<p>Return to Scene 1 of our flash movie. Create a new layer named &#8220;bricks&#8221; and drag your &#8220;mc_brickHolder&#8221; symbol from the library to the stage. Select the symbol on the stage, and open the Info pallette (&#8221;Window &gt; Info&#8221; or command-I). Set the width to 73, the height to 10, the x to 37.5 and the y to 44 (Fig. 5).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig5.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>We now want to place this symbol 4 columns across and 4 rows up. Click on the symbol, select &#8220;Edit &gt; Copy&#8221; (command-C) and then select &#8220;Edit &gt; Paste&#8221; (command-V). This will add another instance of the symbol to your stage. Move this instance so that it sits next to your first symbol (it doesn&#8217;t have to be exact, we&#8217;ll fix it in a minute). Paste two more intances of the symbol, and align them 4 across, setting the 4th one against the right side of the stage. Now, select all 4 instances (drag your mouse over all, or &#8220;shift-click&#8221; on each symbol), and open the Align pallette (&#8221;Windows &gt; Align&#8221; or command-K). Be sure that the &#8220;To Stage&#8221; button is deselected, and click on the distribute horizontal button and the align vertical center buttons to set all 4 instances in a perfect row, equally spaced apart (Fig 6).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig6.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>With all four rectangles still selected, do another copy paste. In the Properties panel (Window &gt; Properties &gt; Properties or command F3), next to &#8220;Color&#8221;, select &#8220;Tint&#8221; from the drop down, and choose an orange color from the color pallette (Fig. 7). Position this row above the row of red rectangles (you can use the Align pallette if needed). Repeat this process 2 more times, making one set of bricks blue and one green. You should now have the grid similar to Fig 1 at the beginning of this tutorial.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut12_fig7.gif" alt="Flash Game Tutorial Fig. 2" /></p>
<p>That&#8217;s it. We are now done with our Flash game! Go ahead and test your movie and see what happens. While this is a relatively simple and basic game, I think it&#8217;s a great start to learning about Flash game development and design. I hope you enjoyed this tutorial, and have fun playing your newly created game. In a future tutorial, I will show you how to add a scoring feature, as well as player &#8220;lives&#8221;.</p>
<p>Thanks for reading!</p>
<p>Continue to <a title="Flash Game Tutorial part 3" href="http://mikestickney.com/wordpress/flash-tutorial-game-scores/" >Part 3 &gt;&gt;</a></p>
<p><strong>Source Files (Flash 8): </strong><a title="Flash Tutorial: Breakthru Flash Game Part 2" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game2.fla" >Flash Tutorial: Breakthru Flash Game Part 2</a><a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game.fla"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/flash-tutorial-flash-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Breakout Game Part 1</title>
		<link>http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/</link>
		<comments>http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 22:42:33 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[ActionScript 2.0]]></category>

		<category><![CDATA[Flash ActionScript tutorial]]></category>

		<category><![CDATA[flash games]]></category>

		<category><![CDATA[Flash tutorials]]></category>

		<category><![CDATA[game development]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=30</guid>
		<description><![CDATA[Flash Tutorial: Creating a Brick Breaking Paddle Game in Flash
Level: This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Creating a Brick Breaking Paddle Game in Flash</p>
<p><strong>Level:</strong> This is a beginner lesson, but I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> In this tutorial, I will explain the first part of making a game similar to the old BreakOut game for Atari. In this part, I will show you how to set up the ball and paddle movement for the demo below.</p>
<p><strong>Demo:</strong><br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://mikestickney.com/flash/breakthru_game.swf" /><embed type="application/x-shockwave-flash" width="300" height="250" src="http://mikestickney.com/flash/breakthru_game.swf"></embed></object></p>
<p><strong>Let&#8217;s get started!</strong></p>
<p>Select &#8220;File &gt; New&#8221; (command-&#8221;N&#8221;) and select Flash File (ActionScript 2.0) to open a new Flash document file. Save the file, and give it the appropriate name. <span id="more-30"></span>I will call this &#8220;breakthru_game1.fla&#8221;. Feel free to change the document dimensions to whatever you like (&#8221;Modify &gt; Document&#8221; or &#8220;command-J&#8221;), but for the purpose of this tutorial, I will use 300&#215;250 pixels. Let&#8217;s also give our stage a background color of black. You can either do this using &#8220;Modify &gt; Document&#8221; (command-J), or by setting the &#8220;Background&#8221; color in your &#8220;Properties Panel&#8217; (&#8221;Window &gt; Properties &gt; Properties&#8221; or command-F3).</p>
<p>The first thing we will do is set up the ball. On the center of your stage, draw a small circle using the &#8220;Oval Tool&#8221; (&#8221;O&#8221;) approximately 15 pixels in diameter with a white fill and no stroke. (Tip: Hold &#8220;Shift&#8221; when dragging the mouse to draw a perfect circle). Select your circle and select &#8220;Modify &gt; Convert to Symbol&#8221; (F8). In the &#8220;Convert to Symbol&#8221; dialog box, give your symbol a name of &#8220;mc_ball&#8221;, and select the &#8220;Movie Clip&#8221; radial. Also be sure to select the center box in the &#8220;Registration&#8221; (Fig 1) and hit &#8220;OK&#8221;.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut11_fig1.gif" alt="Flash Game Tutorial Fig. 1" /></p>
<p>Now that our ball is a movie clip, we can add actions to it. Select your circle on the stage, and in the &#8220;Properties Panel&#8221;, give it an instance name of &#8220;ball&#8221;. With your ball still selected, open the &#8220;Actions&#8221; panel (&#8221;Window &gt; Actions&#8221; or &#8220;alt-F9&#8243;) and insert the following code (I will try to explain the code later):</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(load) {<br />
dir = Math.round(Math.random() * 1);<br />
speed =10;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">if (dir == 1) {<br />
var Ang = 45;<br />
} else {<br />
var Ang = 135;<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">xspeed = speed * Math.cos((Ang) * Math.PI / 180);<br />
yspeed = speed * Math.sin((Ang) * Math.PI / 180);<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(enterFrame) {<br />
this._x += xspeed;<br />
this._y += yspeed;<br />
if ((this._x &lt;= 5) || (this._x &gt;= 295)) {<br />
xspeed = -xspeed;<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">if ((this._y &lt;= 5) || (_root.pad.hitTest(this))) {<br />
yspeed = -yspeed;<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">if (this._y &gt; 300) {<br />
_x = 150;<br />
_y = 100;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">dir = Math.round(Math.random() * 1);<br />
speed = 10;<br />
if (dir == 1) {<br />
var Ang = 45;<br />
} else {<br />
var Ang = 135;<br />
}<br />
xspeed = speed * Math.cos((Ang) * Math.PI / 180);<br />
yspeed = speed * Math.sin((Ang) * Math.PI / 180);<br />
}<br />
}</span></p>
<p>We now have movement of our ball using ActionScript. You can go ahead and test your movie if you want (&#8221;Control &gt; Test Movie&#8221; or command-Return). The ball will move towards the bottom of the page at an angle, disappear off the bottom and then start again from the center of the stage.</p>
<p>What we need to do now is create a &#8220;paddle&#8221; for our ball to bounce off of. For this, we will create a small rectangle, approximately 10 pixels high by 50 pixels wide, with a white fill and no stroke. Place this rectangle near the bottom edge of your stage. (Fig 2)</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut11_fig2.gif" alt="Flash Game Tutorial Fig. 2" width="340" height="320" /></p>
<p>Select your rectangle, and choose &#8220;Modify &gt; Convert to Symbol&#8221; (F8). Give your symbol a name of &#8220;mc_paddle&#8221; and be sure to select the &#8220;Movie Clip&#8221; radial. Now, with the rectangle selected on the main stage, give it an instance name of &#8220;pad&#8221;. With your movie clip still selected, open the Actions Panel and insert the following code:</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(enterFrame) {</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">if(Key.isDown(Key.RIGHT)) {<br />
if(this._x &lt;= 275) {<br />
this._x += 10<br />
}<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">if(Key.isDown(Key.LEFT)) {<br />
if(this._x &gt;= 25) {<br />
this._x -= 10;<br />
}<br />
}<br />
}</span></p>
<p>That&#8217;s it! We have now set up the ball and paddle movement for our game. If you test your movie, you should see the ball move as before, and you should be able to move the paddle (rectangle) from side to side with the arrow keys. When the ball hits the paddle, the top or either the left or right side, it should bounce off and move in the opposite direction. Now, I will try to explain the code and hopefully it will help you understand what is happening here. I&#8217;ve also heavily commented the source code (for those of you who are impatient), which you can download below.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Code Explanation for the Ball (circle):</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(load) {</span></p>
<p>When the movie clip loads, perform the actions between the curly brackets.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">dir = Math.round(Math.random() * 1);</span></p>
<p>Sets a random direction of either 0 or 1 where 0 = left, 1 = right.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">speed =10;</span></p>
<p>Sets the speed the ball will travel. Higher the number, the faster the ball will move.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if (dir == 1) {<br />
var Ang = 45;</span></p>
<p>If the direction of the ball (set randomly above) is equal to 1 (right), then the angle of the movement will be 45 degrees.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">} else {<br />
var Ang = 135;<br />
}</span></p>
<p>Otherwise, the angle of the movement will be 135 degrees.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">xspeed = speed * Math.cos((Ang) * Math.PI / 180);</span></p>
<p>Sets the x vector for the ang, and tells flash how much to move the balls x coordinate.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">yspeed = speed * Math.sin((Ang) * Math.PI / 180);<br />
}</span></p>
<p>Sets the y vector for the ang, and tells flash how much to move the balls y coordinate.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">o</span><span style="color: #000080;">nClipEvent(enterFrame) {</span></p>
<p>When the clip enters this frame, perform the actions between the curly brackets.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">this._x += xspeed;<br />
this._y += yspeed;</span></p>
<p>Sets the _x and _y coordinates to the xspeed and yspeed we determined on the onLoad above.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if ((this._x &lt;= 5) || (this._x &gt;= 295)) {<br />
xspeed = -xspeed;<br />
}</span></p>
<p>If the _x coordinate is less than five or (||) the _x coordinate is greater than 295, reverse the xspeed of the ball. Basically, what this says is if the ball hits either side of the stage, reverse the direction (change xspeed from postive to negative or vice versa). The numbers 5 (left edge) and 295 (right edge) correspond to the size of your stage and take into account that the _x coordinate of your ball is based on the center point. For the true &#8220;edge&#8221; of the stage we would use 0 and 300 (the width of the stage), but then half the ball would be off the visible area of the stage before the direction change took effect.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if ((this._y &lt;= 5) || (_root.pad.hitTest(this))) {<br />
yspeed = -yspeed;<br />
}</span></p>
<p>This is basically doing the same as our _x statement above, but is setting the _y coordinate to change direction if it hits either the top of the stage (_y&lt;=5), or if it hits the pad (_root.pad.hitTest(this))) where &#8220;this&#8221; is the ball and &#8220;_root.pad.&#8221; is the rectangle instance name.</p>
<p style="padding-left: 30px;">i<span style="color: #000080;">f (this._y &gt; 300) {</span></p>
<p>if the ball goes below the bottom of the stage (greater than 300, our stage height of 250 plus a little extra so there is a slight pause when we miss it)</p>
<p style="padding-left: 30px;"><span style="color: #000080;">_x = 150;<br />
_y = 100;<br />
dir = Math.round(Math.random() * 1);<br />
speed = 10;<br />
if (dir == 1) {<br />
var Ang = 45;<br />
} else {<br />
var Ang = 135;<br />
}<br />
xspeed = speed * Math.cos((Ang) * Math.PI / 180);<br />
yspeed = speed * Math.sin((Ang) * Math.PI / 180);<br />
}<br />
}</span></p>
<p>Set a new ball using the same actions we used for the &#8220;onLoad&#8221; above.</p>
<p>Code explanation for the paddle (much simpler than the ball&#8230;):</p>
<p style="padding-left: 30px;"><span style="color: #000080;">onClipEvent(enterFrame) {</span></p>
<p>On enterFrame, perform the action between the curly brackets.</p>
<p style="padding-left: 30px;">i<span style="color: #000080;">f(Key.isDown(Key.RIGHT)) {</span></p>
<p>If the right arrow key is pressed&#8230;.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if(this._x &lt;= 275) {</span></p>
<p>and the _x coordinate is less than 275 (the width of our stage minus 1/2 the width of our paddle)&#8230;</p>
<p style="padding-left: 30px;"><span style="color: #000080;">this._x += 10<br />
}<br />
}</span></p>
<p>move the paddle 10 pixels to the right.</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if(Key.isDown(Key.LEFT)) {</span></p>
<p>If the left arrow key is pressed&#8230;</p>
<p style="padding-left: 30px;"><span style="color: #000080;">if(this._x &gt;= 25) {</span></p>
<p>and the _x coordinate is greater than 25 (1/2 the width of our paddle)&#8230;</p>
<p style="padding-left: 30px;"><span style="color: #000080;">this._x -= 10;<br />
}<br />
}<br />
}</span></p>
<p>move the paddle 10 pixels to the left.</p>
<p>Since there is a lot going on with this, I decided to break this game tutorial into several parts. Check back soon for Part 2 which will explain how to set up the bricks which is really what turns this into a fun, interactive game.</p>
<p>Continue to <a title="Flash Game Tutorial part 2" href="http://mikestickney.com/wordpress/flash-tutorial-flash-game/" >Part 2 &gt;&gt;</a></p>
<p><strong>Source Files (Flash 8): </strong><a title="Flash Tutorial: Breakthru Flash Game Part 1" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/05/breakthru_game.fla">Flash Tutorial: Breakthru Flash Game Part 1<br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/flash-tutorial-breakout-game-part-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Tutorial: Dynamic Buttons</title>
		<link>http://mikestickney.com/wordpress/flash-tutorial-dynamic-buttons/</link>
		<comments>http://mikestickney.com/wordpress/flash-tutorial-dynamic-buttons/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 21:02:26 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[ActionScript tutorials]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flash Tutorial]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[actionscript tutorial]]></category>

		<category><![CDATA[dynamic buttons]]></category>

		<guid isPermaLink="false">http://mikestickney.com/wordpress/?p=29</guid>
		<description><![CDATA[Flash Tutorial: Adding buttons dynamically to the Flash stage using ActionScript
Level: This is an intermeidate lesson, so I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.
Version: I will be using Flash CS3 and AS2 (athough tut is compatible with earlier [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Flash Tutorial:</strong> Adding buttons dynamically to the Flash stage using ActionScript</p>
<p><strong>Level:</strong> This is an intermeidate lesson, so I will assume that the reader is familiar with the basic use of the Flash software including stage, timeline, drawing tools, property window, etc.</p>
<p><strong>Version:</strong> I will be using Flash CS3 and AS2 (athough tut is compatible with earlier versions of Flash) and instructions are for the Mac. Windows users would use the PC counterparts for specific instructions on Flash Menu/Shortcut instuctions.</p>
<p style="text-align: left;"><strong>Description:</strong> In this tutorial, I will explain how to add buttons to your Flash movie with dynamic text content using ActionScript:</p>
<p><strong>Demo:</strong> 
<object type="application/x-shockwave-flash" width="250" height="100">
<param name="movie" value="http://mikestickney.com/wordpress/wp-content/uploads/2008/04/dynamicButton_tutorial.swf" />
<embed src="http://mikestickney.com/wordpress/wp-content/uploads/2008/04/dynamicButton_tutorial.swf" type="application/x-shockwave-flash" width="250" height="100" >
</object>
</p>
<p>Let&#8217;s get started!</p>
<p><strong>Note:</strong> For this tutorial, I will be using the buttons I created for a previous tutorial titled &#8220;Animating a button using a mask effect&#8221;.</p>
<p><span id="more-29"></span>If you haven&#8217;t already, I recommend you start with that tutorial, as I will not be going over the animation process of the button symbols in this tutorial. If you already know how to create button animations, you can use your own button animation symbol, or <a title="Flash Tutorial: Animated Button with Mask Effect" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/03/btnWithMask_tut1.fla" >download the previous tutorial source file here</a>.</p>
<p align="center">&#8212;- ads by google &#8212;-<br />
</p>
<p>Select &#8220;File &gt; New&#8221; (command-&#8221;N&#8221;) and select Flash File (ActionScript 2.0) to open a new Flash document file. Save the file, and give it the appropriate name. I will call this &#8220;dynamicButton_tutorial.fla&#8221;. Feel free to change the document dimensions to whatever you like (&#8221;Modify &gt; Document or &#8220;command-J&#8221;), but for the purpose of this tutorial, I will use 250&#215;100 pixels.</p>
<p>Choose &#8220;File &gt; Import &gt; Open External Library&#8221; (shift-cmd-O), and navigate to where you placed the source file of our previous tutorial (btnWithMask_tut1.fla) and click &#8220;Open&#8221;. What this will do is open up just the &#8220;Symbol Library&#8221; of that source file. Tip: You can also access the symbol library of any .fla file you have open with the dropdown menu in your Symbol Library window (Fig. 1).</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut10_fig1.gif" alt="Dynamic button tutorial fig. 1" width="450" height="455" /></p>
<p>We will be using the symbol called &#8220;mc_btn1&#8243; from the Button With Masked Animation source file, so we can simply click and drag this symbol from one library to the other. (Fig. 1). If you notice, when you drag the one symbol, it should also place the symbol &#8220;img_highlight&#8221; in your current file symbol library. This is because the &#8220;img_highlight&#8221; symbol is used within the &#8220;mc_btn1&#8243; symbol, so Flash knows to import all associated symbols as well.</p>
<p>You can go ahead and close the external symbol library so save space since we don&#8217;t need any other symbols from there. In our dynamic button .fla symbol library, double click on our &#8220;mc_btn1&#8243; symbol to bring us into symbol editing mode. You should see several layers and animation tweens in your timeline. We are going to leave all of this as is, so go ahead and lock all of these layers. What we need to do is add our text boxes that we will be using as our button labels. Add a new layer above your layer named &#8220;mask&#8221; and call it &#8220;text&#8221;. WIth the text tool (T), draw a box roughly the same width of our button, and position it on the center of our button shape. Select your text box, and in the Properties Panel (WIndow &gt; Properties &gt; Properties (cmd-F3)), and give it the settings in Fig. 2.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut9_fig2.gif" alt="Dynamic button tutorial fig. 2" width="350" height="85" /></p>
<p>Now, select the text box, choose Edit &gt; Copy (cmd-C) and then Edit &gt; Paste in Place (cmd-shift-V), and move it 2 or three pixels up and to the left. In Properties Panel, leave all the settings the same, except change the instance name from &#8220;textBlack&#8221; to &#8220;textWhite&#8221;, and change the color to white. What we are doing is simply giving our button label a basic &#8220;dropshadow&#8221; effect, just to make it more easily legible on all the button states.</p>
<p>We are now done editing our button, but since we are going to be placing our button on the stage using ActionsScript, the final thing we need to do is assign our buttona &#8220;Linkage&#8221; identifier name. Not to be confused with &#8220;symbol name&#8221; or &#8220;instance name&#8221;, an identifier name is used to call our button in ActionScript in order to be place on our stage. To give you button an id, right-click (control-click) on your button symbol in your library, and select &#8220;Linkage&#8230;&#8221; from the menu. This will open the Linkage Properties window (Fig. 3). Click on the &#8220;Export for ActionScript&#8221; check box and in the &#8220;Identifier&#8221; field, type &#8220;button&#8221; and hit OK.</p>
<p><img src="http://www.spitshine-design.com/images/tutorials/tut10_fig3.gif" alt="Dynamic button tutorial fig. 3" width="400" height="255" /></p>
<p>Now, it&#8217;s time for our ActionScript. It may look like a lot, but don&#8217;t be too intimidated, it&#8217;s not nearly as complicated as it looks, I promise!</p>
<p>On our main timeline, click on the first (and only) layer and give it a name of &#8220;actions&#8221;. In keyframe one, open the Actions Panel (Window &gt; Actions or alt-F9) and paste the following code:</p>
<p style="text-align: left; padding-left: 30px;"><span style="color: #000080;">onLoad = function(){<br />
var button:Array = [home, about, contact];</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">var xPosition:Number = 50;<br />
var yPosition:Number = 15;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">for(i=0;i&lt;button.length;i++){<br />
_root.attachMovie(&#8221;button&#8221;,&#8221;btn&#8221;+i,_root.getNextHighestDepth());</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root[&#8221;btn&#8221;+i]._x = xPosition;<br />
_root[&#8221;btn&#8221;+i]._y = yPosition;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">yPosition = yPosition + 25;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root.btn0.textBlack.text = &#8220;Home&#8221;;<br />
_root.btn1.textBlack.text = &#8220;About&#8221;;<br />
_root.btn2.textBlack.text = &#8220;Contact&#8221;;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root.btn0.textWhite.text = &#8220;Home&#8221;;<br />
_root.btn1.textWhite.text = &#8220;About&#8221;;<br />
_root.btn2.textWhite.text = &#8220;Contact&#8221;;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root.btn0.link = &#8220;http://www.spitshine-design.com&#8221;;<br />
_root.btn1.link = &#8220;http://www.spitshine-design.com/about.html&#8221;;<br />
_root.btn2.link = &#8220;http://www.spitshine-design.com/contact.html&#8221;;</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">_root[&#8221;btn&#8221;+(i)].onRollOver = btnOver;<br />
_root[&#8221;btn&#8221;+(i)].onRollOut = btnOut;<br />
_root[&#8221;btn&#8221;+(i)].onRelease = btnRelease;<br />
_root[&#8221;btn&#8221;+(i)].onPress = btnPress;<br />
}<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">function btnOver(){<br />
this.gotoAndPlay(&#8221;over&#8221;);<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">function btnOut(){<br />
this.gotoAndPlay(&#8221;off&#8221;);<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">function btnPress(){<br />
this.gotoAndStop(&#8221;down&#8221;);<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #000080;">function btnRelease() {<br />
this.gotoAndStop(&#8221;off&#8221;);<br />
getURL(this.link);<br />
}</span></p>
<p style="text-align: left;">That&#8217;s it! Go ahead and test your movie. You should see 3 buttons appear, stacked, with the top one labled &#8220;home&#8221;, the middle one labeled &#8220;about&#8221; and the bottom one labeled &#8220;contact&#8221;. You should also see the animation on the different rollover states as well.</p>
<p>Since there is a lot of code here, rather than explain it all here, I decided to heavily comment the code in the source file. Since the real objective of any tutorial is for the reader to actually learn WHY things work and not just how, I encourage you to <a title="Flash Tutorial: Dynamic Buttons source file" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/04/dynamicButton_tutorial.fla" >download the source file</a> and read through the comments. The comments also help to explain the different items that need to be edited to customize your menu, such as placement, position and labels.</p>
<p>As always, I hope you found this tutorial helpful, and comments/questions are welcome. Thanks for reading!</p>
<p><strong>Source Files (Flash 8): </strong><a title="Flash Tutorial: Dynamic Buttons" href="http://mikestickney.com/wordpress/wp-content/uploads/2008/04/dynamicButton_tutorial.fla" >Flash Tutorial: Character Movement with Arrow Keys</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikestickney.com/wordpress/flash-tutorial-dynamic-buttons/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
