<?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>Web Design Dev &#187; flash website</title>
	<atom:link href="http://www.webdesigndev.com/tag/flash-website/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webdesigndev.com</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 16:30:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating a Flash Portfolio Website</title>
		<link>http://www.webdesigndev.com/flash/creating-a-flash-portfolio-website</link>
		<comments>http://www.webdesigndev.com/flash/creating-a-flash-portfolio-website#comments</comments>
		<pubDate>Tue, 22 Jul 2008 11:28:44 +0000</pubDate>
		<dc:creator>Web Design</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[Creating Websites]]></category>
		<category><![CDATA[flash portfolio]]></category>
		<category><![CDATA[flash tutorial]]></category>
		<category><![CDATA[flash web design]]></category>
		<category><![CDATA[flash website]]></category>

		<guid isPermaLink="false">http://www.webdesigndev.com/?p=42</guid>
		<description><![CDATA[This tutorial will take you through a step by step process to create a complete website using Flash CS3 and ActionScript 3.0. If you do not have any Flash or ActionScript experience, please still follow along. You'll be amazed at what you can do! Fun stuff! Let's get started! ]]></description>
			<content:encoded><![CDATA[<h2>Learn How to Create a Portfolio Website Using Adobe Flash</h2>
<p>To take a quick peek at what you&#8217;ll be creating, go to <a onclick="javascript:window.open('http://www.jwright.info');">www.jwright.info</a> | <a href="http://www.webdesigndev.com/jwright.zip">Download Source Files</a></p>
<p>Getting Started: Setting up our <a title="flash website" href="http://www.webdesigndev.com/flash/learn-how-to-create-a-flash-website">flash website</a> Project</p>
<p>Before I begin &#8211; for those of you who want an easy way out of this tutorial, you can <a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&amp;experiment_id=af_webdesigndev.com10" target="_blank">create a free  flash website with Wix</a> that will look like a very professional website. Now for those who are still interested in going through with the tutorial, I will continue.</p>
<p>Open up Adobe Flash CS3 and create a new Flash Project. <em>File&#8211;&gt;New&#8211;&gt;Flash Project</em>.<br />
Click <em>Ok</em>. Name your project <em>jwright.info.flp</em>.</p>
<p>Tip: I like to create a folder as one central location for all of my files (e.g.<br />
a folder named jwright.info) to keep everything together.</p>
<p>Next, select <em>File&#8211;&gt;New&#8211;&gt;Flash File (ActionScript 3.0)</em>. Click <em>Ok</em>.<br />
It&#8217;s a good idea to go ahead and save your project. Let&#8217;s do so. <em>File&#8211;&gt;Save</em> (or Ctrl+S). Name the new Flash file <em>jwright.info.fla</em>.</p>
<p>Now we can add our Flash file to our project. Right click on the project file and<br />
click <em>Add File&#8230;</em> as shown below. If you do not see you Project Panel, open<br />
it up by selecting <em>Window&#8211;&gt;Project</em> (or Shift+F8) from the main toolbar.</p>
<div class="pic">
<p><img src="/flashportfolio/Project.bmp" alt="" /></p>
<p>Add the file <em>jwright.info.fla</em> to the project.</p>
<p>Setting up the Timeline</p>
<p>Let&#8217;s start by setting up the layers that make up our site. Click the <em>Insert Layer<br />
Folder</em> button for the timeline. Rename this folder <em>Pages</em> by right<br />
clicking the folder and choosing <em>Properties</em> or by double clicking the folder.</p>
<p><img src="/flashportfolio/NewFolderBtn.bmp" alt="" /></p>
<p>Follow the similar procedure for adding a new folder for each page we will need: <em>Start, Home, Profile, Resume, Contact, Portfolio,</em> and <em>Respect</em>. Also,<br />
create a folder called <em>Master</em>.</p>
<p>Here&#8217;s a look at what you should now have in your timeline. Ensure that each page<br />
folder is a subfolder of <em>Pages</em>. You can do this by dragging the layer into<br />
the proper place. (You may delete the default layer <em>Layer1</em>, if it&#8217;s still<br />
listed.)</p>
<div class="pic">
<p><img src="/flashportfolio/OurFolders.bmp" alt="" /></p>
<p>Oh boy, we&#8217;re rockin&#8217; now! Let&#8217;s insert a new layer in the <em>Master</em> folder.<br />
Click the <em>Insert Layer</em> button found near the the <em>Inser Layer Folder</em> button.</p>
<div class="pic">
<p><img src="/flashportfolio/NewLyrBtn.bmp" alt="" /></p>
<p>Name the new layer <em>Splash</em>. Again, be sure that the <em>Splash</em> layer is<br />
inside of the <em>Master</em> folder.</p>
<p>Follow the same steps to add the rest of our <em>Master</em> layers: <em>Main Menu, House,<br />
Logo, Arrows, Copyright, </em>and of course <em>Splash</em>.</p>
<p>Here&#8217;s a stunning view of our timeline so far.</p>
<div class="pic">
<p><img src="/flashportfolio/OurFoldersAndLayers.bmp" alt="" /></p>
<p>Okay, now in each page folder (excluding <em>Master</em>) insert two layers named <em>Content</em> and <em>Actions</em> like so.</p>
<p><img src="/flashportfolio/ContentActions.bmp" alt="" /></p>
<p>Now, we want to add the keyframes for our website. Essentially, each page has a<br />
keyframe used to display the page we need. Then we can navigate to each requested<br />
page via frames.</p>
<p>Insert a keyframe on each page layer in sequence. Example: The <em>Start</em> page&#8217;s<br />
keyframe goes on frame 1; The <em>Home</em> page&#8217;s keyframe goes on frame 2; etc.<br />
Like so. To insert a keyframe, right click on the desired frame and choose <em>Insert<br />
Keyframe</em> (or select the frame and hit F6).</p>
<div class="pic">
<p><img src="/flashportfolio/InitialKeyframes.bmp" alt="" /></p>
<p>A couple more things before the real fun begins.</p>
<p>Create two more layers (not in any folder) named <em>Frame Labels</em> and <em>Actions</em>.</p>
<p>We&#8217;ll place a lot of our ActionScript for the site in the <em>Actions</em> layer later<br />
on. We&#8217;re going to use the <em>Frame Labels</em> layers for our site navigation. So,<br />
let&#8217;s setup our Frame Labels.</p>
<p>Actually, let&#8217;s first define a Frame Label. Simple, simple. A Frame Label is really<br />
just a way we can use an identifier for our page instead of always accessing a page<br />
by its frame number. It&#8217;ll make more sense in a minute&#8211;bear with me.</p>
<p>Select the first seven frames on the <em>Frame Labels</em> layer. Then, convert them<br />
to keyframes (F6). Here&#8217;s a look.</p>
<p><img src="/flashportfolio/FrameLabels.bmp" alt="" /></p>
<p>We need to give these Frame Labels a name. Select the first frame (frame 1) and give<br />
it a name in the <em>Properties</em> panel. Let&#8217;s call it <em>start_frm</em>. This naming<br />
convention is consistent with our page layer names.</p>
<div class="pic">
<p><img src="/flashportfolio/NameFrame.bmp" alt="" /></p>
<p>You should now see little flag in the first frame. Repeat these steps to name the<br />
rest of our Frame Labels. Here&#8217;s a look at what you should have when all are named.</p>
<p><img src="/flashportfolio/AllFramesNamed.bmp" alt="" /></p>
<p>Well done ladies and gentlemen. Moving on&#8230;</p>
<p>Creating the Main Layout</p>
<p>On the Properties panel, <em>Window&#8211;&gt;Properties&#8211;&gt;Properties</em> (or Ctrl+F3), click<br />
the size button. This will display the Document Properties form.</p>
<div class="pic">
<p><img src="/flashportfolio/DocProps.bmp" alt="" /></p>
<p>Set the <em>Dimensions</em> width to 885.15 px and the height to 578 px. Set the <em>Background<br />
color</em> to White (#FFFFFF), the <em>Frame rate</em> to 32 fps (frames per second),<br />
and the <em>Ruler units</em> to Pixels.</p>
<p>Ready for our first graphic? Me too. First, let&#8217;s lock all of the layers but the<br />
one we need&#8211; the <em>Splash</em> layer.</p>
<div class="pic">
<p><img src="/flashportfolio/LockLayers.bmp" alt="" /></p>
<p>Secondly, from the Tools toolbar, <em>Window&#8211;&gt;Tools</em> (or Ctrl+F2), select the <em>Rectangle Primitive Tool</em> (or R). Change the stroke color to #EBEBEB, and<br />
set the fill color to #FFFFFF via the color pickers on the Properties panel. Set<br />
the corners rounded to 18.</p>
<p>Here&#8217;s a shot of the properties panel for some help.</p>
<div class="pic">
<p><img src="/flashportfolio/PrimiRectProps.bmp" alt="" /></p>
<p>Now draw a primi rectangle 787.1 (width) by 468.4 (height) on the stage. Note: Ensure<br />
the <em>Splash</em> layer is selected.</p>
<p>It&#8217;s Movie Clip time. Select your primi and hit F8. This will pop up the Convert<br />
to Symbol form. Name it <em>SplashMc</em> and select Movie clip as the type. Click <em>Ok</em>.</p>
<p>This Mc looks pretty sad. Let&#8217;s spice it up! Select <em>Window&#8211;&gt;Properties&#8211;&gt;Filter</em>.<br />
Select our <em>SplashMc</em> and hit the <em>Add Filter</em> button on the Filters panel<br />
and select <em>Drop Shadow</em>.</p>
<p>Next set the drop shadow&#8217;s properties shown below.</p>
<p><img src="/flashportfolio/DropShadow.bmp" alt="" /></p>
<p>Let&#8217;s align this bad boy! Open up the align panel <em>Window&#8211;&gt;Align</em> (or Ctrl+K).<br />
Select your Mc and click <em>Align horizontal center</em> and then <em>Align vertical center</em>.</p>
<div class="pic">
<p><img src="/flashportfolio/AlignSplash.bmp" alt="" /></p>
<p>Now that it&#8217;s centered beautifully, let&#8217;s move it down a little. About six hits<br />
on the down arrow on your keyboard. My X,Y coords for this Mc is now 442.6,307.2;<br />
however, I&#8217;ve seen these X,Y&#8217;s vary a little from computer to computer. Not sure<br />
why, but that&#8217;s life I guess.</p>
<p>The copyright. First, lock the <em>Splash</em> layer and unlock the <em>Copyright</em> layer. Create a new Text Box using the text tool (T). Type in <em>Copyright © 2007-2008<br />
jwright.info. All Rights Reserved.</em> Note: You can find the copyright symbol on your Windows start menu. <em>Start&#8211;&gt;All Programs&#8211;&gt;Accessories&#8211;&gt;System<br />
Tools&#8211;&gt;Character Map.</em> (That is, if you have a PC with Windows.)</p>
<p>Again, use the Align tool to center the copyright horizontally and then align on<br />
the bottom edge. So far, so good. Right? Here&#8217;s our stage.</p>
<div class="pic">
<p><img src="/flashportfolio/Copyright.bmp" alt="" /></p>
<p>Next, our navigation arrows. Let&#8217;s look at how to make an arrow button. I&#8217;m not<br />
going into this a great deal as I want to focus on the &#8220;programming a flash site&#8221;<br />
as opposed to &#8220;creating each little graphic for a flash site.&#8221; Michael&#8217;s got some<br />
great tutorials for graphics. I&#8217;ll leave that to the pros.</p>
<p>To make a button, open up the Library (Ctrl+L). You should see the <em>SplashMc</em> we created earlier. Click the <em>New Symbol&#8230;</em> in the bottom left of the Library<br />
panel. Name the button <em>ForwardBtn</em> and be sure to select <em>Button</em>. Click <em>Ok</em>.</p>
<p>As a side note here, it&#8217;s a good idea to create some folders in the library to organize<br />
everything. One for MovieClips, one for Buttons, etc.</p>
<p>Back on the stage now, place your arrow button center stage. Add a new keyframe<br />
in the <em>Over</em> frame. Make the button how you want it to look when you hover<br />
over it&#8211;I just changed my fill color to white. Then again for the <em>Down</em> frame.</p>
<p>Follow the same steps for your back button. Be sure to name it <em>BackwardBtn</em>.</p>
<p>Let&#8217;s go back to the main stage by clicking <em>Scene1</em> as shown below.</p>
<div class="pic">
<p><img src="/flashportfolio/Scene1.bmp" alt="" /></p>
<p>From the Library, drag your two buttons onto the <em>Arrows</em> layer. Using the<br />
Align tool, align the backward arrow on the left edge and the forward arrow on the<br />
right edge.</p>
<p>To align the arrows vertically we&#8217;re going to use Rulers. We don&#8217;t want to just &#8220;Align vertically&#8221; because our <em>SplashMc</em> is not aligned vertically. Remember?<br />
We moved it down some? We want the arrows to be aligned with good ol&#8217; splashy.</p>
<p>Bring up the rulers by selecting <em>View&#8211;&gt;Rulers</em> (or Ctrl+Alt+Shift+R). Select<br />
the <em>SplashMc</em> on the <em>Splash</em> layer (you may need to unlock it). Drag<br />
a ruler guide down from the horizontal ruler, intersecting the center point of splashy.</p>
<div class="pic">
<p><img src="/flashportfolio/SplashyCtrPt.bmp" alt="" /></p>
<p>Now select both arrows and intersect them with your ruler guide, like so.</p>
<p><img src="/flashportfolio/ArrowsCentered.bmp" alt="" /></p>
<p>On to the logo. Use whatever logo you&#8217;d like. Place it on the <em>Logo</em> layer.</p>
<p>You may do the same for the little house button on the upper right. Place it on<br />
the <em>House</em> layer.</p>
<p>Our main layout so far.</p>
<div class="pic">
<p><img src="/flashportfolio/MainLayoutSoFar.bmp" alt="" /></p>
<p>The Flying Menu</p>
<p>Although the main menu is definitely a part of our main layout, it deserves its<br />
own section. This, my friends, is the most difficult part of the site; however,<br />
it&#8217;s just a bit tedious&#8211;nothing earth shattering. Let us begin!</p>
<p>To get started, create a new symbol (just like you did for the arrow buttons). Name<br />
it <em>MainMenuMc</em> and select <em>Movie clip</em> as the type. Click <em>Ok</em>.</p>
<p>Secondly, let&#8217;s setup or Mc&#8217;s timeline. Create a new folder called <em>Menu Items</em> and insert five new layers into the folder. Name them <em>Profile, Resume, Contact, Portfolio,</em> and <em>Respect</em> respectively (no pun intended).</p>
<p>On the <em>Contact</em> layer, place a new Text Box with the text <em>contact</em>.<br />
This text should be black, 15pt font, Arial, with a letter spacing of 1. See below.</p>
<div class="pic">
<p><img src="/flashportfolio/ContactButton.bmp" alt="" /></p>
<p>Convert the Text Box to a button. Select it, hit F8, select type <em>Button</em>,<br />
name it <em>ContactBtn</em> click <em>Ok</em>. Double click the new symbol to edit it.<br />
Insert a new keyframe in the <em>Over</em> frame and change the text color to #999999.</p>
<p>Now let&#8217;s set up some guide lines. From the <em>ContactBtn</em>&#8216;s center point, drag<br />
two vertical guides to the left of the button. One spaced 100 units away and<br />
the other spaced 200 units away from the button&#8217;s center point. Do the same to the<br />
right of the button. Also, drag a horizontal guide intersecting the button&#8217;s center<br />
point.</p>
<p>Here&#8217;s a clarifying example.</p>
<div class="pic">
<p><img src="/flashportfolio/MenuGuides.bmp" alt="" /></p>
<p>Next, create the other four buttons just like the <em>ContactBtn</em> we just made: <em>ProfileBtn, ResumeBtn, PortfolioBtn,</em> and <em>RespectBtn</em>. Then, place those<br />
buttons on the intersecting guides like the following. Be sure to place each button<br />
on the proper corresponding layer.</p>
<div class="pic">
<p><img src="/flashportfolio/MenuItemPlacement.bmp" alt="" /></p>
<p>No, we&#8217;re not done with the menu yet, but we need a reference point for the rest of<br />
it. So, let&#8217;s go ahead and place our menu (from the Library) on our main stage on<br />
the <em>Main Menu</em> layer&#8211;centered vertically and centered horizontally in respect<br />
to splashy.</p>
<div class="pic">
<p><img src="/flashportfolio/MainMenuPlacement.bmp" alt="" /></p>
<p>Double click the <em>MainMenuMc</em> to return to edit mode. Drag a horizontal guide<br />
to where you want the menu to fly to.</p>
<div class="pic">
<p><img src="/flashportfolio/FlyToGuide.bmp" alt="" /></p>
<p>Next, insert a new layer and call it <em>Dummy</em>. Copy and paste all five buttons<br />
into this dumb layer. Align them horizontally on the guide we just made. Trust me<br />
on this one. Here&#8217;s a look see.</p>
<div class="pic">
<p><img src="/flashportfolio/DummyMenuLayer.bmp" alt="" /></p>
<p>This is going to be how we set up our destination point for our menu items when<br />
they fly into place. If you can think of a better way, awesome. Go for it.</p>
<p>Space each button about 3 little units away from the button to its right. Use the<br />
guide lines to help.</p>
<div class="pic">
<p><img src="/flashportfolio/MenuItemSpacing.bmp" alt="" /></p>
<p>Now intersect some guides on each dummy menu item&#8217;s center point. Be careful not<br />
to confuse these guides with the ones for our real menu.</p>
<div class="pic">
<p><img src="/flashportfolio/DummyIntersection.bmp" alt="" /></p>
<p>Okay, now hide the dummy layer. We could delete it now as we won&#8217;t need it anymore,<br />
but just in case we need to return to it&#8211;it&#8217;s there. Hide by selecting the layer<br />
and clicking the dot on the dummy layer under the <em>Show/Hide All Layers</em> button.</p>
<div class="pic">
<p><img src="/flashportfolio/HideLayer.bmp" alt="" /></p>
<p>On to the flight plan. Let&#8217;s draw some motion guides. First, select the <em>Respect</em> layer. Click the <em>Add Motion Guide</em> button.</p>
<div class="pic">
<p><img src="/flashportfolio/AddGuide.bmp" alt="" /></p>
<p>Using the Line tool (N), draw a line from the <em>RespectBtn</em>&#8216;s center point to<br />
it&#8217;s corresponding flight destination. Be sure to draw the guide on the the <em>Repect</em> layer&#8217;s motion guide layer.</p>
<div class="pic">
<p><img src="/flashportfolio/MotionGuide.bmp" alt="" /></p>
<p>Follow the previous steps for the rest of the buttons.</p>
<p>Here&#8217;s what you should end up with.</p>
<p><img src="/flashportfolio/MotionGuides.bmp" alt="" /></p>
<p>Go ahead and lock each guide layer so that we don&#8217;t accidentally select it.</p>
<p>Now for some animation! All right. Insert a frame (not keyframe) on frame 20 for<br />
each layer (excluding <em>Dummy</em>). Right click on frame 20 on the profile layer<br />
and select <em>Create Motion Tween</em>. Carefully select the <em>ProfileBtn</em> button<br />
and drag it up to its destination point.</p>
<p>This will create your flying tween. Here&#8217;s the results.</p>
<div class="pic">
<p><img src="/flashportfolio/TweenedMenuItem.bmp" alt="" /></p>
<p>You can drag the red timeline slider back and forth (or use the &#8216;,&#8217; (comma) and<br />
&#8216;.&#8217; (period) keys) to see your tween in action.</p>
<p>Proceed to do the same for the rest of your menu item buttons.</p>
<p>So that&#8217;s the up flight plan. What about it&#8217;s descent? Well, I&#8217;m glad you asked.<br />
This is simple. Select frame one on each layer, right click on the selection. Choose <em>Copy Frames</em>.</p>
<div class="pic">
<p><img src="/flashportfolio/CopyFrames.bmp" alt="" /></p>
<p>Now select frame 20 for each layer and select <em>Paste Frames</em>, like so.</p>
<div class="pic">
<p><img src="/flashportfolio/PasteFrames.bmp" alt="" /></p>
<p>Well, that was the descent. Check it out using the slider to see your animated menu<br />
in all its glory! (Go ahead and delete the dummy layer if you&#8217;d like.)</p>
<div class="pic">
<p><img src="/flashportfolio/PastedFrames.bmp" alt="" /></p>
<p>Almost done with the menu!</p>
<p>Time for some ActionScript! We need to add some timeline control for our menu. Insert<br />
a new layer named <em>Timeline Control</em>. Select frame 20 in the new layer and<br />
hit F9. Like magic the ActionScript panel opens. Simple stuff here. Just type <code><br />
stop();</code> This will stop the menu at the top of the flight plan when it&#8217;s<br />
played.</p>
<p>Do the same for frame 40 so that the menu will stop at the bottom of its flight<br />
plan. Notice the little <em>a</em> denoting the frame has some ActionScript. Here&#8217;s<br />
a glance.</p>
<div class="pic">
<p><img src="/flashportfolio/TimelineControl.bmp" alt="" /></p>
<p>We need a way to control the menu from the main timeline. So, the solution? We need<br />
to create two functions. First, add another layer in the <em>MainMenuMc</em> timeline<br />
called <em>Actions</em>.</p>
<p>Add the following ActionScript to the <em>Actions</em> layer.</p>
<pre><code>function goHome():void { gotoAndPlay(20); } function leaveHome():void { gotoAndPlay(1); }</code></pre>
<p><img src="/flashportfolio/MainMenuActions.bmp" alt="" /></p>
<p>We&#8217;ll be able to use these two functions to control our main menu.</p>
<p>Congrats! That&#8217;s the end of our main menu. That wasn&#8217;t too bad, right? Great job!</p>
<p>Navigation Control</p>
<p>Now that we have our flying menu, logo button, and our little house on the stage button, let&#8217;s put &#8216;em<br />
to good use. We&#8217;ll be using a good bit more ActionScript (AS) from here on out. Excited?</p>
<p>The first thing we need to do is make sure that our <em>Master</em> layer displays throughout the timeline. To do so,<br />
insert a frame into frame 8.</p>
<div class="pic">
<p><img src="/flashportfolio/Master.bmp" alt="" /></p>
<p>The next thing we need to do is to name our menu. Select the <em>MainMenuMc</em> symbol and set it&#8217;s <em>Instance Name</em><br />
to <em>mainMenu_mc</em>. Now, let&#8217;s add a couple lines of ActionScript to the <em>Actions</em> layer that&#8217;ll run when the<br />
flash file first loads.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Startup. ///////////////////////////////////////////////////////////////////// stop(); mainMenu_mc.stop();</code></pre>
<p>The Startup block serves no purpose but to identify the associated lines of code&#8211;essentially keeping our<br />
code looking pretty and easy to find.</p>
<p>If you have not done so yet, go back into your <em>MainMenuMc</em> symbol and<br />
assign <em>Instance Name</em>s to our menu item buttons. Try to stick with the same naming convention. Like, name the<br />
<em>ProfileBtn</em> <em>profile_btn</em>, etc.</p>
<p>Notice how we use the <em>_btn</em> postfix for Buttons and the <em>_mc</em> postfix for Movie Clips. This will<br />
tell the AS compiler to generate intellisense (What&#8217;s that? See below.) for your object. Kinda like Visual Studio,<br />
Dreamweaver, and other programming IDEs.</p>
<div class="pic">
<p><img src="/flashportfolio/Intellisense.bmp" alt="" /></p>
<p>In order to handle the onclick events of our navigational buttons, we need to setup some event handlers.<br />
Add the following lines of AS to the <em>Actions</em> layer. I&#8217;ll explain the <code>navigationClicked</code> part in a second.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Event Setup. ///////////////////////////////////////////////////////////////////// mainMenu_mc.profile_btn.addEventListener(MouseEvent.CLICK, navigationClicked); mainMenu_mc.resume_btn.addEventListener(MouseEvent.CLICK, navigationClicked); mainMenu_mc.contact_btn.addEventListener(MouseEvent.CLICK, navigationClicked); mainMenu_mc.portfolio_btn.addEventListener(MouseEvent.CLICK, navigationClicked); mainMenu_mc.respect_btn.addEventListener(MouseEvent.CLICK, navigationClicked);</code></pre>
<p>So what in the world did we just do? It&#8217;s called event handling programming. I&#8217;m sure<br />
you&#8217;re familiar with it, but it&#8217;s basically just saying that function &#8220;X&#8221; gets called<br />
when the user clicks button &#8220;B&#8221;&#8211;pretty basic.</p>
<p>So, we have hooked up our main menu&#8217;s navigational buttons to a function called <code>navigationClicked</code><br />
that we are about to define. Now, any time one of those buttons are clicked, this function will be executed.</p>
<p>Here&#8217;s what you should have in your <em>Actions</em> layer for the main stage thus far.</p>
<div class="pic">
<p><img src="/flashportfolio/EventHandlersSoFar.bmp" alt="" /></p>
<p>I know it&#8217;s getting a little more complicated, but hang in there and take your time.</p>
<p>Next, we need to define our <code>navigationClicked</code> function. Here&#8217;s the stubbed out function.<br />
We&#8217;ll add more to this function in a minute. Copy and paste this code under your other code in the<br />
<em>Actions</em> layer.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Event Handlers. ///////////////////////////////////////////////////////////////////// function navigationClicked(Event:MouseEvent):void { }</code></pre>
<p>This next batch of AS (the body of the <code>navigationClicked</code> function) is a<br />
little long; however, it&#8217;s not too complicated. I&#8217;ll try to explain it well as we go along.</p>
<p>We need to determine what page to go to based on what button was clicked. Remember the Frame<br />
Labels we discussed earlier? Here&#8217;s where we&#8217;re going to use them. Bascially, we&#8217;re going<br />
to associate each button with a Frame Label via a common <code>switch</code> statement.</p>
<pre><code>function navigationClicked(Event:MouseEvent):void { //We'll use this to store the Frame Label's name. var frmLabel:String = ''; //Determine what Frame Label to use based on which //button was clicked. switch (Event.target) { case mainMenu_mc.profile_btn : frmLabel = "profile_frm"; break; case mainMenu_mc.resume_btn : frmLabel = "resume_frm"; break; case mainMenu_mc.contact_btn : frmLabel = "contact_frm"; break; case mainMenu_mc.portfolio_btn : frmLabel = "portfolio_frm"; break; case mainMenu_mc.respect_btn : frmLabel = "respect_frm"; break; case logo_btn : frmLabel = frmLabel = "home_frm"; break; case home_btn : frmLabel = "home_frm"; break; } }</code></pre>
<p>Okay, so now we know what Frame Label we need to use. (You may be asking what about our<br />
<em>LogoBtn</em> and <em>HouseBtn</em>. We&#8217;ll get to that in a minute.)</p>
<p>In order to display the page we&#8217;ll use the built-in AS function <code>gotoAndPlay(frame:Number)</code>. We have<br />
a Frame Label which is a <code>string</code>; however, we need the frame&#8217;s number. Let&#8217;s write a little function<br />
to retrieve that number. Here ya go.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Helper Functions. ///////////////////////////////////////////////////////////////////// function getFrame(frameName:String):Number { var frame:Number = 1; //Loop through all Frame Labels to find our requested frame. for (var i = 0; i &lt; currentLabels.length; i++) { if (currentLabels[i].name == frameName) { frame = currentLabels[i].frame; break; } } return frame; }</code></pre>
<p>All we are doing here is looping through all of our Frame Labels (via the built-in <code>currentLabels</code> property)<br />
and comparing the name we found in our <code>switch</code> block to the label we&#8217;re currently looping on.</p>
<p>We can now add the following two lines to the bottom of our <code>navigationClicked</code> function.</p>
<pre><code>var frmGoto:Number = this.getFrame(frmLabel); gotoAndPlay(frmGoto);</code></pre>
<p>Here&#8217;s our function so far.</p>
<pre><code>function navigationClicked(Event:MouseEvent):void { //We'll use this to store the Frame Label's name. var frmLabel:String = ''; //Determine what Frame Label to use based on which //button was clicked. switch (Event.target) { case mainMenu_mc.profile_btn : frmLabel = "profile_frm"; break; case mainMenu_mc.resume_btn : frmLabel = "resume_frm"; break; case mainMenu_mc.contact_btn : frmLabel = "contact_frm"; break; case mainMenu_mc.portfolio_btn : frmLabel = "portfolio_frm"; break; case mainMenu_mc.respect_btn : frmLabel = "respect_frm"; break; case logo_btn : frmLabel = frmLabel = "home_frm"; break; case home_btn : frmLabel = "home_frm"; break; } //Find the frame number based on our Frame Label. var frmGoto:Number = this.getFrame(frmLabel); //Go to the requested page. gotoAndPlay(frmGoto); }</code></pre>
<p>Well, let&#8217;s test out what we have so far. Select <em>Debug&#8211;&gt;Debug Movie</em> (Ctrl+Shift+Enter) from<br />
Flash CS3&#8242;s main menu. This will compile and run your Flash file. If you&#8217;ve missed anything, the<br />
compiler will show you an error.</p>
<div id="in_post_ad_middle_1" style="margin: 5px;padding: 0px;"><a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&experiment_id=af_webdesigndev.com1middlepostnewLP" target="_blank" rel="nofollow">
<img src="http://www.webdesigndev.com/expressions_website3.gif" width="300" height="250" alt="create a free website" /></a></div><p>Here&#8217;s what you should see.</p>
<div class="pic">
<p><img src="/flashportfolio/Debug.bmp" alt="" /></p>
<p>Feel free to click some buttons, but you really won&#8217;t be able to see the pages changing since all<br />
of our pages are blank. Let&#8217;s skip ahead a little and change that. That way we&#8217;ll know our menu<br />
is working.</p>
<p>First, select the frame in your <em>Content</em> layer under the <em>Start</em> page.</p>
<div class="pic">
<p><img src="/flashportfolio/StartLayer.bmp" alt="" /></p>
<p>Secondly, place a Text Box, with text-aligned right, by the <em>HouseBtn</em> symbol, like so.</p>
<div class="pic">
<p><img src="/flashportfolio/HomeLabeler.bmp" alt="" /></p>
<p>Next, follow those same steps to place a label (in the same place) on the <em>Content</em> layers of each page.<br />
Then change the text to represent each page.</p>
<p>Tip: You can select the Text Box you just made on your <em>Start</em> page, select the frame for the <em>Content</em> layer on<br />
the <em>Home</em> page, and select <em>Edit&#8211;&gt;Paste in Place</em> (or Ctrl+Shift+V). This will paste the Text Box<br />
in the exact same place as your <em>Start</em> page.</p>
<p>You will also need to add the following one line of AS to each of the <em>Actions</em> layers for each page&#8211;except the <em>Start</em><br />
page.</p>
<pre><code>stop();</code></pre>
<p>This will ensure that your Flash movie will stop on the requested frame. If not, we would be hitting the requested<br />
frame and then the movie would continue to play out the rest of the movie.</p>
<p>As for the <em>Start</em> page, we need to add the following line of AS. We&#8217;re bascially going to<br />
just skip the start page. The reason is simple. I may want to, at a later time, change my home page to something<br />
different and make the current home page a welcome page. But, for now we&#8217;ll just use our home page as our welcome.<br />
Basically, we&#8217;re just trying to keep our site as maintainable as possible.</p>
<pre><code>gotoAndPlay(2);</code></pre>
<p>Again, notice the little &#8216;a&#8217; on each frame containing AS code.</p>
<div class="pic">
<p><img src="/flashportfolio/Stop.bmp" alt="" /></p>
<p>Before we debug again, let&#8217;s add a couple of lines of AS to our <code>navigationClicked</code> function.</p>
<p>We&#8217;re going to put our <code>gotoAndPlay(frmGoto);</code> line of AS inside of an <code>if</code> statement.<br />
Here&#8217;s the function now.</p>
<pre><code>function navigationClicked(Event:MouseEvent):void { //We'll use this to store the Frame Label's name. var frmLabel:String = ''; //Determine what Frame Label to use based on which //button was clicked. switch (Event.target) { case mainMenu_mc.profile_btn : frmLabel = "profile_frm"; break; case mainMenu_mc.resume_btn : frmLabel = "resume_frm"; break; case mainMenu_mc.contact_btn : frmLabel = "contact_frm"; break; case mainMenu_mc.portfolio_btn : frmLabel = "portfolio_frm"; break; case mainMenu_mc.respect_btn : frmLabel = "respect_frm"; break; case logo_btn : frmLabel = frmLabel = "home_frm"; break; case home_btn : frmLabel = "home_frm"; break; } //Find the frame number based on our Frame Label. var frmGoto:Number = this.getFrame(frmLabel); //Don't do anything if we are already on the requested page. if (currentFrame != frmGoto) { //Go to the requested page. gotoAndPlay(frmGoto); } }</code></pre>
<p>Go ahead and debug now to see your changes in action. Notice how the page label<br />
by the <em>HouseBtn</em> symbol changes as you go from page to page.</p>
<p>Next, let&#8217;s set up our <em>LogoBtn</em> and <em>HouseBtn</em> buttons. After you assign an <em>Instance Name</em><br />
to your buttons, all you need to do is attach the click event of those buttons to our <code>navigationClicked</code><br />
function. Forget how? That&#8217;s cool. Here&#8217;s a<br />
refresher.</p>
<pre><code>logo_btn.addEventListener(MouseEvent.CLICK, navigationClicked); home_btn.addEventListener(MouseEvent.CLICK, navigationClicked);</code></pre>
<p>So now we need to add those guys to our <code>switch</code> statement. After you do that, feel free<br />
to debug again to check it out.</p>
<pre><code>case logo_btn : frmLabel = "home_frm"; break; case home_btn : frmLabel = "home_frm"; break;</code></pre>
<p>How about that flying menu? It&#8217;s time to put it to work! Remember those two functions we made, <code>goHome();</code><br />
and <code>leaveHome();</code>? That&#8217;s how we&#8217;re going to control the menu from our <code>navigationClicked</code> function.<br />
Let&#8217;s have a look how.</p>
<p>All we need to do to implement our flying menu is make a couple of modificaitons to our <code>if</code> statement<br />
in our <code>navigationClicked</code> function. Below are the changes. Be sure to read the commented lines to<br />
understand what we&#8217;re trying to accomplish.</p>
<pre><code>//Don't do anything if we are already on the requested page. if (currentFrame != frmGoto) { //Get and remember the Home page's frame number. var frmHome:Number = this.getFrame("home_frm"); //If our requested page is the Home page, the flying menu //needs to go home. if(frmGoto == frmHome) { mainMenu_mc.goHome(); } //Else, if we are on the Home page and are leaving, then //leave home. else if(currentFrame == frmHome) { mainMenu_mc.leaveHome(); } //Go to the requested page. gotoAndPlay(frmGoto); }</code></pre>
<p>We&#8217;ve only got two buttons to go. Our <em>ForwardBtn</em> and <em>BackwardBtn</em> buttons.</p>
<p>To get started with those fellas, assign them <em>Instance Name</em>s and hook them up to our<br />
<code>navigationClicked</code> function as we&#8217;ve done several times previously.</p>
<p>It&#8217;s a tad tricky to get our <em>forward_btn</em> and <em>backward_btn</em> buttons to cycle the<br />
pages appropriately. I think it will be much clearer if I just give you the code and have you<br />
read through the comments&#8211;instead of dissecting the functions line by line.</p>
<p>The main function here is <code>getSequencedFrame(forward:Boolean)</code>. This function accepts a<br />
<code>Boolean</code> value indicating if the next page is requested or the previous. Then, the function<br />
will determine the Frame Label of the requested page.</p>
<p>Here&#8217;s the two functions you&#8217;ll need. Just copy and paste them into your <em>Helper Functions</em> section.</p>
<pre><code>function getFrameLabel(frame:Number):String { var frmLabel:String = ''; //Loop through all Frame Labels to find the requested Frame Label. for (var i = 0; i &lt; currentLabels.length; i++) { if (currentLabels[i].frame == frame) { frmLabel = currentLabels[i].name; break; } } return frmLabel; } function getSequencedFrame(forward:Boolean):String { //Used to remember the Frame Label of our page. var frmSequence:String = ''; //If we're looking for the next page in sequence... if(forward) { //If our current page is that last page... if(currentFrame == this.getFrame("respect_frm")) { //...then, we need to go Home. frmSequence = "home_frm"; } else { //...else, we just need to go to the next frame. frmSequence = this.getFrameLabel((currentFrame + 1)); } } //...else, we're looking for the previous page in sequence. else { //If we're on the first page (remember, we skipped our Start page)... if(currentFrame == this.getFrame("home_frm") || currentFrame == this.getFrame("start_frm")) { //...then, we need to go to the last page. frmSequence = "respect_frm"; } else { //...else, we just need to go to the the previous frame. frmSequence = this.getFrameLabel((currentFrame - 1)); } } return frmSequence; }</code></pre>
<p>Almost there! Just add this code to your <code>switch</code> statement and you&#8217;re done.</p>
<pre><code>case backward_btn : frmLabel = this.getSequencedFrame(false); reak; case forward_btn : frmLabel = this.getSequencedFrame(true); break;</code></pre>
<p>Congrats folks! You&#8217;ve just completed the hardest part of<br />
<a onclick="javascript:window.open('http://www.jwright.info');">jwright.info</a>.</p>
<p>From here on out, let&#8217;s make each page its own section. That way it will be easier for you<br />
to stop and pick up again later if need be.</p>
<p>The Home Page</p>
<p>First things first. Let&#8217;s spice up our <em>Home</em> page! Make sure that the following symbols go on the<br />
<em>Content</em> layer of our <em>Home</em> page layer.</p>
<p>Create a new Text Box and type in JAMESWRIGHT or use your own name for kicks. Use Arial, 28pt font, and<br />
letter spacing of 33. Now, convert this Text Box to a Movie Clip called <em>NameMc</em>. Also, while we&#8217;re there,<br />
give it an <em>Instance Name</em> of <em>name_mc</em>.</p>
<p>You may use my logo if you&#8217;d like or your own&#8211;as long at it&#8217;s a Movie Clip with an instance name of <em>logo_mc</em>.<br />
Drop it onto the <em>Home</em> page as well.</p>
<p>I also made a little footer called <em>DetDriDetMc</em> with an <em>Instance Name</em> of <em>ddd_mc</em>.</p>
<p>Here&#8217;s a look at our <em>Home</em> page.</p>
<div class="pic">
<p><img src="/flashportfolio/HomePage.bmp" alt="" /></p>
<p>Go ahead and test it out! You can debug like before, or hit Ctrl+Enter to run test mode.</p>
<p>Pretty cool, huh? Well it&#8217;s about to get better. Let&#8217;s add some fade transitions. Since we&#8217;re going to be<br />
using the same transitions on multiple pages and other Movie Clips, we need to put the transition code<br />
into its own class. Here&#8217;s how.</p>
<p>Select <em>File&#8211;&gt;New&#8211;&gt;ActionScript File</em>. Click <em>Ok</em>. Save the file in the same directory as your<br />
Flash files named <em>utils.Fader</em>. Two things are crucial here. The location of the file and the naming of<br />
the file. It must be in the same directory because this is how your AS code will reference this file. Also, the<br />
name signifies the package (a.k.a namespace) to be used.</p>
<p>Add the following code to your new <em>utils.Fader.as</em> file.</p>
<pre><code>package utils { //Import the needed packages. import fl.transitions.Transition; import fl.transitions.TransitionManager; import fl.transitions.Fade; import fl.transitions.easing.*; import flash.display.MovieClip; //Fader class definition. public class Fader { //This function will apply a "fade in" effect for any given Movie Clip. public static function fadeIn(mc:MovieClip):void { //Use the TransitionManager to fade in the movie clip. TransitionManager.start(mc, {type:Fade, direction:Transition.IN, duration:1, easing:Strong.easeIn}); } //This function will apply a "fade out" effect for any given Movie Clip. public static function fadeOut(mc:MovieClip):void { //Use the TransitionManager to fade in the movie clip. TransitionManager.start(mc, {type:Fade, direction:Transition.OUT, duration:1, easing:Strong.easeOut}); } } }</code></pre>
<p><a onclick="javascript:window.open('http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/transitions/TransitionManager.html')"><br />
Click here to read more about the <em>TransitionManager</em>.</a></p>
<p>Now, go ahead and add this AS file to your Flash project as we did in the beginning of the tutorial.</p>
<p>Next, add this code to your main <em>Actions</em> layer. This will allow you to be able to use your <em>Fader</em><br />
class on the main timeline.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Includes and Imports. ///////////////////////////////////////////////////////////////////// import utils.Fader;</code></pre>
<p>To implement your Fader class, simply add these line of AS to your <em>Actions</em> layer for your <em>Home</em> page.</p>
<pre><code>utils.Fader.fadeIn(logo_mc); utils.Fader.fadeIn(name_mc); utils.Fader.fadeIn(ddd_mc);</code></pre>
<p>Great! Now you can test it and check out the cool fade effect! That&#8217;s all for the <em>Home</em> page!</p>
<p>The Profile Page</p>
<p>The first thing we need to do is create a new Movie Clip (Remember, you can do this from the Library panel). Then we want<br />
to place a graphic on the MC that kinda looks like a tab from a tabbed document. Place the tab on its own layer called<br />
<em>Tab</em>. Again, you can find this graphic and others in the package supplied with the tutorial.</p>
<div class="pic">
<p><img src="/flashportfolio/ProfileTab.bmp" alt="" /></p>
<p>Secondly, we need to create some buttons&#8211;just some simple buttons that tell our readers a little bit about us.<br />
All you need to do is create a new button, as you&#8217;ve done before, and place some text in it. Nothing new here.<br />
Here&#8217;s a little snapshot of one of my buttons.</p>
<div class="pic">
<p><img src="/flashportfolio/WhoBtn.bmp" alt="" /></p>
<p>You can create whatever you want here, but if you want to stick with me here, create a button for each <em>Who, What,<br />
When, Where,</em> and <em>Why</em> section that looks like the following. These buttons should be placed in their own<br />
layer, named <em>Buttons</em>.</p>
<div class="pic">
<p><img src="/flashportfolio/ProfileBtns.bmp" alt="" /></p>
<p>Go ahead and give each button an <em>Instance Name</em>. For example, I named my <em>WhoBtn</em> button<br />
<em>whoCap_btn</em>&#8211;since these buttons are like captions.</p>
<p>Now for some pretty cool effects! Let&#8217;s create some &#8220;popups&#8221; for each button we just made. To do so, first create<br />
a new movie clip called <em>WhoPopupMc</em>. These are real simple to make. Essentially, all you need is two layers:<br />
<em>Text</em> and <em>Window</em>.</p>
<p>On the <em>Text</em> layer, simply place the <em>WhoBtn</em> you just made from the Library. Then, on the <em>Window</em><br />
layer place a Rectangle, fill color #333333 and stroke color #FFFFFF, that is a little bigger than your button. You<br />
will also need to create another little button used to close the popup. Feel free to make that button whatever<br />
you like. I just used a little circle. Here&#8217;s a look!</p>
<div class="pic">
<p><img src="/flashportfolio/WhoPopup.bmp" alt="" /></p>
<p>Be sure to give your <em>CloseBtn</em> an <em>Instance Name</em> called <em>close_btn</em>.</p>
<p>Now that you know how to do that, create a &#8220;popup&#8221; for each button.</p>
<p>Once you have created all of your popups, place each popup on its own layer on your <em>ProfileTabMc</em><br />
symbol and assign <em>Instance Name</em>s to your popups. Here&#8217;s what I ended up with.</p>
<div class="pic">
<p><img src="/flashportfolio/Popups.bmp" alt="" /></p>
<p>Next, you&#8217;ll need to insert another layer called <em>Actions</em> to your <em>ProfileTabMc</em> symbol. On this layer<br />
let&#8217;s add some AS event handlers for our buttons. Here they are to save you some time and typing.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Event Setup. ///////////////////////////////////////////////////////////////////// whoCap_btn.addEventListener(MouseEvent.CLICK, showPopup); whatCap_btn.addEventListener(MouseEvent.CLICK, showPopup); whenCap_btn.addEventListener(MouseEvent.CLICK, showPopup); whereCap_btn.addEventListener(MouseEvent.CLICK, showPopup); whyCap_btn.addEventListener(MouseEvent.CLICK, showPopup); whoPup_mc.close_btn.addEventListener(MouseEvent.CLICK, closePopup); whatPup_mc.close_btn.addEventListener(MouseEvent.CLICK, closePopup); whenPup_mc.close_btn.addEventListener(MouseEvent.CLICK, closePopup); wherePup_mc.close_btn.addEventListener(MouseEvent.CLICK, closePopup); whyPup_mc.close_btn.addEventListener(MouseEvent.CLICK, closePopup);</code></pre>
<p>Before we define our event handler functions, we need to add some AS to help us control which popup is<br />
currently showing. So, how do we do that? Again, nothing new here. We&#8217;re just going to write a simple<br />
<code>switch</code> statement to set a variable called <code>currentPopup</code>.</p>
<p>All that&#8217;s going on here is we are determining which button was clicked and then setting a Movie Clip variable<br />
to the popup we need to display. Here&#8217;s the code.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Variables. ///////////////////////////////////////////////////////////////////// var currentPup:MovieClip = null; ///////////////////////////////////////////////////////////////////// // Helper Functions. ///////////////////////////////////////////////////////////////////// function setCurrentPopup(e:Event):void { //Set the current popup based on which caption was clicked. switch(e.target) { case whoCap_btn: currentPopup = whoPopup_mc; break; case whatCap_btn: currentPopup = whatPopup_mc; break; case whenCap_btn: currentPopup = whenPopup_mc; break; case whereCap_btn: currentPopup = wherePopup_mc; break; case whyCap_btn: currentPopup = whyPopup_mc; break; } }</code></pre>
<p>Next, we need to define our event handler functions <code>showPopup</code> and <code>closePopup</code>.</p>
<p>I know I say this alot, but, this shouldn&#8217;t be too complicated. Just a couple basic event handlers. We&#8217;ll<br />
also want to add some cool fading effects here as well, so we&#8217;re going to import the <code>utils.Fader</code><br />
class.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Includes and Imports. ///////////////////////////////////////////////////////////////////// import utils.Fader; ///////////////////////////////////////////////////////////////////// // Event Handlers. ///////////////////////////////////////////////////////////////////// function closePopup(Event:MouseEvent):void { //If the current popup has been set, fade it out. if(this.currentPopup != null) utils.Fader.fadeOut(currentPopup); } function showPopup(Event:MouseEvent):void { //Set the current popup. this.setCurrentPopup(Event); //If the current popup has been set, fade it in. if(this.currentPopup != null) utils.Fader.fadeIn(currentPopup); }</code></pre>
<p>To see your changes, you&#8217;ll need to go back to the main timeline and add your new <em>ProfileTabMc</em> symbol<br />
to your <em>Content</em> layer in the <em>Profile</em> page section. You can use the Free Transform tool (Q) to make<br />
it fit to your stage accordingly if the size of your symbol isn&#8217;t just right.</p>
<p>You can preview you profile page now if you&#8217;d like (Ctrl+Enter).</p>
<p>You&#8217;ll probably notice that your popups start out being visible. To fix this issue let&#8217;s add some more AS to<br />
the <em>ProfileTabMc</em>&#8216;s <em>Actions</em> layer. This AS block will tell the popups to not be visible on startup.<br />
After you add this code to your MC, test it out and see the cool effects!</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Startup. ///////////////////////////////////////////////////////////////////// whoPopup_mc.visible = false; whatPopup_mc.visible = false; whenPopup_mc.visible = false; wherePopup_mc.visible = false; whyPopup_mc.visible = false;</code></pre>
<p>You like? Cool. Well, only one more tweak before we move on to the next page. If you notice, when you click any<br />
of your buttons, the corresponding popup displays. That&#8217;s what it should do; however, even after a popup displays<br />
you can still click another button. This is not a desired behavior. Let&#8217;s come up with a way to stop this. Here&#8217;s<br />
what I have.</p>
<p>My proposal is to make a layer that will cover up the other buttons while a popup is being displayed. So, go back<br />
into your <em>ProfileTabMc</em> symbol and copy the tab&#8211;just the tab part, not the buttons. Next, paste that tab into<br />
a new symbol. Call it <em>TabCoverMc</em>. One small touch, change the graphic&#8217;s Alpha property to 80% in fill color<br />
picker.</p>
<div class="pic">
<p><img src="/flashportfolio/Alpha.bmp" alt="" /></p>
<p>After you create that symbol, drag it into your <em>ProfileTabMc</em> symbol on a new laber called <em>TabCover.</em> Be<br />
sure that the layer is above the <em>Buttons</em> layer and below the <em>Popups</em> layer. Here&#8217;s the result.</p>
<div class="pic">
<p><img src="/flashportfolio/TabCover.bmp" alt="" /></p>
<p>Now you can give the <em>TabCoverMc</em> symbol an <em>Instance Name</em> of <em>tabCover_mc</em>. We also want this symbol<br />
to be hidden on startup. So, let&#8217;s hide it just like our caption buttons.</p>
<pre><code>tabCover_mc.visible = false;</code></pre>
<p>When the user clicks a caption button to see a popup, we can now cover up the other buttons with the new <em>TabCoverMc</em><br />
symbol in our <code>showPopup</code> and <code>closePopup</code> functions. Here are the modified functions.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Event Handlers. ///////////////////////////////////////////////////////////////////// function closePopup(Event:MouseEvent):void { //Fade out the tab cover. utils.Fader.fadeOut(tabCover_mc); //If the current popup has been set, fade it out. if(this.currentPopup != null) utils.Fader.fadeOut(currentPopup); } function showPopup(Event:MouseEvent):void { //Set the current popup. this.setCurrentPopup(Event); //Fade in the tab cover. utils.Fader.fadeIn(tabCover_mc); //If the current popup has been set, fade it in. if(this.currentPopup != null) utils.Fader.fadeIn(currentPopup); }</code></pre>
<p>To finish off this section, add a fade effect to the <em>ProfileMc</em> symbol in your <em>Actions</em> layer. This<br />
will fade in your <em>ProfileMc</em> symbol when the page is displayed.</p>
<div class="pic">
<p><img src="/flashportfolio/FadeProfile.bmp" alt="" /></p>
<p>Take a look at the <em>Profile</em> page now. It&#8217;s a beauty! Great job!</p>
<p>The Résumé Page</p>
<p>The <em>Résumé</em> page won&#8217;t take long at all. First create a new Movie Clip call <em>ResumeMc</em>.<br />
Inside of the MC, you&#8217;ll need to either copy and paste my résumé or use your own. One little thing,<br />
make sure to check the Check Box marked <em>Export for ActionScript</em>.</p>
<div class="pic">
<p><img src="/flashportfolio/ExportToAs.bmp" alt="" /></p>
<p>Well that was simple enough. Now, let&#8217;s use it. Next you&#8217;ll need to create another Movie Clip called<br />
<em>ResumeScollerMc</em>. Inside of this MC you&#8217;ll need a ScrollPane from the Components panel. You<br />
can find that under <em>Window&#8211;&gt;Components</em> (or Ctrl+F7). Once you locate the ScrollPane, drag one<br />
onto your <em>ResumeScrollPaneMc</em>.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollPane.bmp" alt="" /></p>
<p>This is a really neat control. Since our résumé is too long to fit on splashy, the ScrollPane component will<br />
scroll our <em>ResumeMc</em> symbol up and down. All we need to do is to set a couple of the ScrollPane&#8217;s<br />
parameters to tell it which MC we want it to scroll.</p>
<p>To view the ScrollPane&#8217;s parameters, select <em>Window&#8211;&gt;Properties&#8211;&gt;Parameters</em>. Then select your ScrollPane<br />
and you should see its parameters listed on the Parameters panel.</p>
<p>The only parameter you should need to set is the <em>source</em> parameter. Set that to the symbol we want to<br />
scroll&#8211;<em>ResumeMc</em>. This is the reason you needed to check <em>Export for ActionScript</em> when making the<br />
<em>ResumeMc</em> symbol. In a nutshell, since we&#8217;re not adding this directly to our stage, the AS compiler needs<br />
to know what MC to scroll.</p>
<div class="pic">
<p><img src="/flashportfolio/Parameters.bmp" alt="" /></p>
<p>You may now drag the <em>ResumeScrollerMc</em> onto the main timeline on the <em>Content</em> layer of the <em>Resume</em><br />
page. Also, add a fade effect to the <em>ResumeScrollerMc</em> symbol in your <em>Actions</em> layer. You can do this<br />
the same exact way you did the <em>ProfileMc</em> symbol&#8217;s fade effect.</p>
<p>More than likely, you&#8217;re going to notice that your scrollbar does not look like mine. If that&#8217;s the case, you can<br />
actually edit the ScrollPane component&#8211;just like a Movie Clip. Pretty awesome, huh?! Just locate the ScrollPane<br />
in your Library (probably under <em>Component Assets</em>), right click, and choose <em>Edit</em>.</p>
<p>You should see something like the following. Double click the ScrollBar Skins symbol.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollBarSkins.bmp" alt="" /></p>
<p>Now, you can edit any of the skins you see before you. Here&#8217;s what mine look like after I&#8217;ve tweaked them.</p>
<div class="pic">
<p><img src="/flashportfolio/Skins.bmp" alt="" /></p>
<p>That&#8217;s it for the <em>Resume</em> page! On to the <em>Contact</em> page.</p>
<p>The Contact Page</p>
<p>The <em>Contact</em> page really does not need much explanation. You&#8217;ve already done this multiple times.</p>
<p>But, just for kicks, here you go. All you need to do is create a new Movie Clip called <em>ContactMc</em><br />
that contains your contact information. Simple stuff really. Then you can give it an <em>Instance Name</em><br />
and use the <code>utils.Fader</code> class to fade in the MC when the <em>Contact</em> page&#8217;s frame is hit.</p>
<p>That&#8217;s it!</p>
<div class="pic">
<p><img src="/flashportfolio/ContactPage.bmp" alt="" /></p>
<p>The Portfolio Page</p>
<p>My <em>Portfolio</em> page definitely needs some work. But we&#8217;ll walk through what we have anyway. It&#8217;s<br />
basically just using two buttons that will open a new window.</p>
<p>All I did to create my buttons was take a screen shot of a couple websites I&#8217;ve been working on. Then I imported<br />
them into my Library and dropped them on a button. Then, on the <em>Over</em> frame of the button, I made the<br />
image a little bigger and added a caption at the bottom. Here&#8217;s the first button for reference.</p>
<div class="pic">
<p><img src="/flashportfolio/PortfolioButton.bmp" alt="" /></p>
<p>After you create your two buttons, simply drop them onto your main stage.</p>
<p>Next you can add a little heading if you&#8217;d like.</p>
<div class="pic">
<p><img src="/flashportfolio/PortfolioHeading.bmp" alt="" /></p>
<p>Select your three items&#8211;the heading and the two buttons. Next, hit F8 and convert those<br />
three things into one Movie Clip so we will be able to add our fade effect. I called my new MC <em>PortfolioMc</em>.</p>
<p>We&#8217;re almost done! Let&#8217;s add a little bit of AS to open up a new browser window when a button is clicked. Double click<br />
your <em>PortfolioMc</em> symbol to take it into Edit mode. Next, add a new layer called <em>Actions</em>. In that layer<br />
paste the following code.</p>
<pre><code>css_btn.addEventListener(MouseEvent.CLICK, cssClicked); mlt_btn.addEventListener(MouseEvent.CLICK, mltClicked); function cssClicked(event:MouseEvent):void { //Create a new URL request. var url:URLRequest = new URLRequest("http://www.clixsoftwaresolutions.com/"); //Open up the URL in a new window. navigateToURL(url, "_blank"); } function mltClicked(event:MouseEvent):void { //Create a new URL request. var url:URLRequest = new URLRequest("http://www.mylooptracker.com/"); //Open up the URL in a new window. navigateToURL(url, "_blank"); }</code></pre>
<p>I know what you&#8217;re thinking. Yes, we could&#8217;ve used another <code>switch</code> statement, but for just two buttons<br />
I opted to just use two functions. Good catch though!</p>
<p>Finally, just add your <code>utils.Fade.fadeIn(portfolio_mc)</code> function call into the <em>Portfolio</em> pages&#8217;s<br />
<em>Action</em> layer on the main timeline, and you&#8217;re done!</p>
<p>Note: If you debug your movie now and try to click one of your buttons on the <em>Portfolio</em> page, you will<br />
probably see the following warning. No worries, it&#8217;s supposed to do that. If you test your movie (Ctrl+Enter) or<br />
deploy your movie&#8211;it should work like a charm!</p>
<div class="pic">
<p><img src="/flashportfolio/Warning.bmp" alt="" /></p>
<p>The Respect Page</p>
<p>Ahhhhhh, at last. The final page. Well, in my opinion, I&#8217;ve saved the best for last. I love this little scroller,<br />
and the best part is that it&#8217;s not too hard to achieve this awesome effect.</p>
<p>Start out by making a new Movie Clip called <em>RespectStageMc</em>. On the first layer in our MC we want to introduce<br />
something new to jwright.info&#8211;masking. You&#8217;ll see the power of masking real soon.</p>
<p>Secondly, place a rectangle centered on the page on a layer called <em>Scroll Area</em>. Set its fill color to #999999<br />
with no stroke. Don&#8217;t worry about size quite yet. Next, go back to your main timeline and add the MC to the <em>Content</em><br />
layer on your <em>Respect</em> page.</p>
<p>Now, you can go back into your MC and adjust the size of your rectangle to be the exact width of splashy.<br />
(Remember him?) Make sure that your MC is centered with your navigational arrow buttons before you resize anything.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollArea.bmp" alt="" /></p>
<p>Let&#8217;s add a little more to our MC. Let&#8217;s place a darker rectangle (#333333) above and below our <em>Scroll Area</em> layer.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollArea2.bmp" alt="" /></p>
<p>Next, add a heading.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollHeading.bmp" alt="" /></p>
<p>On to the thumbnails! Again, feel free to use the thumbnail buttons I&#8217;ve already made, or you can make your own. The concept<br />
is pretty much like what you did on the <em>Portfolio</em> page&#8211;just a little smaller. Here&#8217;s what one of mine looks like.</p>
<div class="pic">
<p><img src="/flashportfolio/Thumb.bmp" alt="" /></p>
<p>After you get all of your thumbnails made, place them all centered, and spaced evenly, on a single layer called<br />
<em>Thumbs</em> in your MC.</p>
<p>Next, you&#8217;ll need to go back into that MC and paste this code. No real need to explain here. We&#8217;re just popping up a new<br />
browser window and loading the site that was clicked.</p>
<div class="pic">
<p><img src="/flashportfolio/ThumbsInline.bmp" alt="" /></p>
<pre><code>///////////////////////////////////////////////////////////////////// // Includes and Imports. ///////////////////////////////////////////////////////////////////// import flash.net.navigateToURL; import flash.net.URLRequest; ///////////////////////////////////////////////////////////////////// // Event Setup. ///////////////////////////////////////////////////////////////////// advanced_btn.addEventListener(MouseEvent.CLICK, gotoSite); henz_btn.addEventListener(MouseEvent.CLICK, gotoSite); kalou_btn.addEventListener(MouseEvent.CLICK, gotoSite); studio_btn.addEventListener(MouseEvent.CLICK, gotoSite); crystal_btn.addEventListener(MouseEvent.CLICK, gotoSite); deepBlue_btn.addEventListener(MouseEvent.CLICK, gotoSite); wolf_btn.addEventListener(MouseEvent.CLICK, gotoSite); freedom_btn.addEventListener(MouseEvent.CLICK, gotoSite); ///////////////////////////////////////////////////////////////////// // Event Handlers. ///////////////////////////////////////////////////////////////////// function gotoSite(Event:MouseEvent):void { var url:URLRequest = null; switch (Event.target) { case advanced_btn : url = new URLRequest("http://www.2advanced.com/"); break; case henz_btn : url = new URLRequest("http://www.henzstudio.com/"); break; case kalou_btn : url = new URLRequest("http://www.kalou.ch/fr/"); break; case studio_btn : url = new URLRequest("http://www.studiopiro.com/index2.htm"); break; case crystal_btn : url = new URLRequest("http://www.crystalmedia.co.yu/"); break; case deepBlue_btn : url = new URLRequest("http://www.deepblue.com/"); break; case wolf_btn : url = new URLRequest("http://www.wolfpeak.net/"); break; case freedom_btn : url = new URLRequest("http://www.freedomoftheseas.com/"); break; } if (url != null) { navigateToURL(url, "_blank"); } }</code></pre>
<p>After you&#8217;ve done that, select all of your thumbs and convert them into one single Movie Clip called <em>ThumbsScrollerMc</em>.<br />
You&#8217;ll see why in just a minute.</p>
<p>As you can see right now, the thumbnails are running off of the stage to the left. If you test your movie you&#8217;ll<br />
see them there as well. This is not what we want. We want the thumbnails to disappear as they move off of splashy.</p>
<p>To achieve this effect we need to use a technique called <em>Masking</em>. To mask the thumbnails, insert a new layer<br />
above your <em>Thumbs</em> layer called <em>Scroll Mask</em>. Right click on the new layer and select <em>Mask</em>.</p>
<p>On this layer you&#8217;ll need to create a rectangle the same exact size as the one on your <em>Scroll Area</em> layer. May I suggest that<br />
you just copy and paste-in-place that rectangle from the <em>Scroll Area</em> layer. You will need to change its<br />
fill color alpha value to 10%. This is just so you can see what&#8217;s behind the mask.</p>
<p>If you test your movie now, you&#8217;ll notice how the only thumbnails that display are the ones that are directly behind the mask.</p>
<p>Now, the cool part. To be able to scroll left and right, you&#8217;ll need a left and right arrow. I just used the arrow buttons<br />
we used on our main timeline and placed them on a new layer. I also added a little white border around the arrows.</p>
<div class="pic">
<p><img src="/flashportfolio/ScrollArrows.bmp" alt="" /></p>
<p>Here&#8217;s the code you&#8217;ll need to scroll your <em>ThumbScrollerMc</em> named <em>thumbs_mc</em>.</p>
<pre><code>///////////////////////////////////////////////////////////////////// // Includes and Imports. ///////////////////////////////////////////////////////////////////// import fl.transitions.Tween; import fl.transitions.easing.Regular; ///////////////////////////////////////////////////////////////////// // Event Setup. ///////////////////////////////////////////////////////////////////// left_btn.addEventListener(MouseEvent.CLICK, scrollLeft) right_btn.addEventListener(MouseEvent.CLICK, scrollRight) ///////////////////////////////////////////////////////////////////// // Event Handlers. ///////////////////////////////////////////////////////////////////// function scrollLeft(Event:MouseEvent):void { //Shift the MC left 150 units. var myTween:Tween = new Tween(thumbs_mc, "x", Regular.easeOut, thumbs_mc.x, (thumbs_mc.x - 150), 1, true); } function scrollRight(Event:MouseEvent):void { //Shift the MC right 150 units. var myTween:Tween = new Tween(thumbs_mc, "x", Regular.easeOut, thumbs_mc.x, (thumbs_mc.x + 150), 1, true); }</code></pre>
<p>Essentiall, we are just shifting the <em>ThumbsScrollerMc</em> left and right when the user clicks an<br />
arrow button. Test it out!</p>
<p>The only thing left to do is to add the fade in effect on the main timeline for the <em>RespectStageMc</em><br />
symbol. Great work!</p>
<h2>Conclusion</h2>
<p>Well congrats fellow Flashians! You now know how to create <a title="flash websites" href="http://www.webdesigndev.com/flash/learn-how-to-create-a-flash-website">flash websites</a> and have successfully completed the entire<br />
<a onclick="javascript:window.open('http://www.jwright.info')">jwright.info</a> website!</p>
<p>Feel free to also look at the HTML file included in the package to see how the .swf file is displayed in the<br />
browser.</p>
<p>I know this tutorial was a little long&#8211;maybe the longest you&#8217;ve ever done. But the content covered in this<br />
walk through should give you a <strong>great</strong> foundation for developing your own Flash site. Keep up the good work! By the way, if you feel like this is too much work, you can <a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&amp;experiment_id=af_webdesigndev.com" target="_blank">create a free professional flash website with Wix</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.webdesigndev.com/flash/creating-a-flash-portfolio-website/feed</wfw:commentRss>
		<slash:comments>101</slash:comments>
		</item>
		<item>
		<title>Flash Website Tutorial</title>
		<link>http://www.webdesigndev.com/flash/flash-website-tutorial</link>
		<comments>http://www.webdesigndev.com/flash/flash-website-tutorial#comments</comments>
		<pubDate>Sat, 28 Jun 2008 18:28:39 +0000</pubDate>
		<dc:creator>Web Design</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[creating flash websites]]></category>
		<category><![CDATA[flash tutorial]]></category>
		<category><![CDATA[flash website]]></category>

		<guid isPermaLink="false">http://www.webdesigndev.com/?p=36</guid>
		<description><![CDATA[In this tutorial we will show you how you can make an advanced flash website with some great features. This tutorial covers pagetransitions, flash preloaders, disabled button and the first steps for tweening with actionscript 2.0.]]></description>
			<content:encoded><![CDATA[<h2>Creating a flash website using actionscript 2.0</h2>
<table width="264" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img src="/flashwebsite/ico_cat_ps.gif" alt="" width="20" height="19" hspace="5" vspace="5" /></td>
<td><a href="/flashwebsite/layout.psd">Download PSD</a></td>
<td><img src="/flashwebsite/ico_cat_fl.gif" alt="" width="20" height="19" hspace="5" vspace="5" /></td>
<td><a href="/flashwebsite/1.fla">Download FLA </a></td>
</tr>
</tbody>
</table>
<p>Result of the <a title="flash website" href="http://www.webdesigndev.com/flash/learn-how-to-create-a-flash-website">flash website</a> tutorial, click to view in flash:</p>
<p><a href="/flashwebsite/1.swf" target="_blank"><img src="/flashwebsite/49.jpg" alt="" width="702" height="701" border="0" /></a></p>
<p>Before I begin &#8211; for those of you who want an easy way out of this tutorial, you can <a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&amp;experiment_id=af_webdesigndev.com10" target="_blank">create a free  flash website with Wix</a> that will look like a very professional website. Now for those who are still interested in going through with the tutorial, I will continue.</p>
<h2>Step1 &#8211; Making a Flash Preloader</h2>
<p>Open a new flash file.</p>
<p><img src="/flashwebsite/1.jpg" alt="" width="656" height="424" /></p>
<p>And give it these settings.</p>
<p><img src="/flashwebsite/2.jpg" alt="" width="372" height="339" /></p>
<p>First we are going to make the preloader.<br />
Make a new movie clip. Insert &#8212;&gt;&gt; New Symbol (Ctrl+F8)</p>
<p><img src="/flashwebsite/3.jpg" alt="" width="414" height="139" /></p>
<p>Now you are in the preloader movie clip.</p>
<p>And make 3 layers with 100 frames. Name the maskT, text and textW.</p>
<p><img src="/flashwebsite/4.jpg" alt="" width="1025" height="180" /></p>
<p>Make another symbol and call it loading_mc.</p>
<p><img src="/flashwebsite/5.jpg" alt="" width="413" height="152" /></p>
<p>In that movie clip type in loading.</p>
<p><img src="/flashwebsite/6.jpg" alt="" width="678" height="145" /></p>
<p>Once you have made that movie clip then duplicate it. And call it loading1_mc.</p>
<p><img src="/flashwebsite/8.jpg" alt="" width="219" height="360" /></p>
<p>And in that movie clip make the text green.</p>
<p><img src="/flashwebsite/50.jpg" alt="" width="741" height="309" /></p>
<p>Now open your preloader_mc and drag the movie clip loading_mc on to the stage.<br />
Make sure that you are in the layer textW.</p>
<p>Don&#8217;t forget to center it on the stage.</p>
<p><img src="/flashwebsite/7.jpg" alt="" width="215" height="146" /></p>
<p>And in the layer called text you drag the loading1_mc into it. And center<br />
it.</p>
<p>Now in the first frame of the maskT layer we will draw a rectangle. Like<br />
this.</p>
<p><img src="/flashwebsite/9.jpg" alt="" width="678" height="193" /></p>
<p>Still in the maskT layer go to frame 100 and right click to convert to key<br />
frame.</p>
<p><img src="/flashwebsite/10.jpg" alt="" width="197" height="406" /></p>
<p>Now drag the rectangle on top of the text.</p>
<p><img src="/flashwebsite/11.jpg" alt="" width="153" height="98" /></p>
<p>Place your cursor in between frame 1 and 100 from the maskT layer, right click<br />
and add a motion tween.</p>
<p><img src="/flashwebsite/12.jpg" alt="" width="209" height="81" /></p>
<p>Now move with the cursor on the layer, right click and select mask.<br />
This will add the layer text under the mask.</p>
<p><img src="/flashwebsite/13.jpg" alt="" width="193" height="205" /></p>
<p>Now go back to your scene1 and change the name of the first layer to preloader.</p>
<p>Now drag your preloader_mc onto the stage.</p>
<p>While in the first layer press F9 to open up the actions window. Click on the movie<br />
clip in the stage and the paste this in the window.</p>
<p><img src="/flashwebsite/14.jpg" alt="" width="762" height="465" /><br />
<span style="color: #00cc00;"><br />
onClipEvent (load) {<br />
total = _root.getBytesTotal();<br />
}<br />
onClipEvent (enterFrame) {<br />
loaded = _root.getBytesLoaded();<br />
perc1ent = int(loaded/total*100);<br />
perc1 = &#8220;&#8221;+perc1ent+&#8221;%&#8221;;<br />
gotoAndStop(perc1ent);<br />
if (loaded == total) {<br />
_root.gotoAndPlay(2);<br />
}<br />
}</span></p>
<p>Now click on the layer and go to the actions window and give it this code</p>
<p><span style="color: #00cc00;">stop();</span></p>
<p>Now make a second layer and convert it to a key frame.(F6) and paste this code.</p>
<p>This code tells flash to check the bytes that are loaded .if it’s loaded then go<br />
to frame3 if not stay in frame 1.</p>
<p>You may think what happened to frame2 . Well you are in it.</p>
<p><span style="color: #00cc00;">if(_root.getBytesLoaded() ==<br />
_root.getBytesTotal()){<br />
gotoAndPlay(3);<br />
}<br />
else{<br />
gotoAndPlay(1);<br />
} </span></p>
<h2>Step 2 &#8211; Making the Smooth Page Transitions</h2>
<p>Start by importing your PSD to flash, if you do not know how to do this, read our <a title="Permanent Link to Importing Images in to Adobe Flash" href="http://www.webdesigndev.com/flash/importing-images-in-to-adobe-flash" rel="bookmark">Importing Images in to Adobe Flash Tutorial.<br />
</a><a><br />
href=&#8221;http://www.webdesigndev.com/flash/importing-images-in-to-adobe-flash&#8221;&gt;<br />
</a>Now make a new movie clip and name it content_mc. And drag the square<br />
on it.<br />
<img src="/flashwebsite/17.jpg" alt="" width="700" height="407" /></p>
<p>Now make a second layer in scene1 and call it content.<br />
Click on the third frame and press F6 to make it a key frame.</p>
<p>Now drag your content_mc to the stage and center it horizontal.</p>
<p><img src="/flashwebsite/16.jpg" alt="" width="701" height="706" /></p>
<p>Select frame 15 and convert it to a key frame. Now right click between frame<br />
3 and 15 and make a motion tween.</p>
<p>In frame 3 and change its brightness to -100%</p>
<p>lets make the pages first. the content to fill these is up to you. I will show<br />
you how to do those page transitions that so many people want to know.</p>
<p>I will show you a very easy way to do this.</p>
<p>Lets me the pages first . make a new movie clip and call it homePage_mc.</p>
<p>Make a layer for each thing that you add. Will be allotting better if you<br />
want to change some things later on.</p>
<p>I have 2 layers. a layer with bigger text and the some text to fill this page.</p>
<p><img src="/flashwebsite/28.jpg" alt="" width="623" height="290" /></p>
<p>Now change some text for the other pages . Since I don&#8217;t use this site I will<br />
only change the main text .</p>
<p>So you will see that the pages change. Once you made all the pages we will implant<br />
them into scene1.</p>
<p>So go to scene1 and add 2 new layers , call it <span style="color: #00cc00;">pages</span><br />
and the other 1 <span style="color: #00cc00;">actionsMain</span>.<br />
.<br />
First insert frames on frame 140 for the layers <span style="color: #00cc00;">content</span><br />
, <span style="color: #00cc00;">pages</span> and <span style="color: #00cc00;">actions.</span><br />
Add a <span style="color: #00cc00;">stop();</span> in the actionsmain on frame<br />
35.</p>
<p>In the pages layer you need to add key frames . So when we link the buttons<br />
that know where to go to.</p>
<p>Add key frame in the following frames : 35 , 45 , 54 , 59 , 69 , 78 , 82 , 92,<br />
101 , 105 , 115 , 124</p>
<p>Now do the same for the actions layer.</p>
<p>It should look like this.</p>
<p><img src="/flashwebsite/29.jpg" alt="" width="1149" height="38" /></p>
<p>In the pages layer select frame 35 . Now drag your homePage_mc on the stage and<br />
place it like this.</p>
<p><img src="/flashwebsite/31.jpg" alt="" width="701" height="419" /><br />
Copy frame 35 and paste in frames 45 and 54.</p>
<p>Now change the alpha of the movie clip homePage_mc to 0%.</p>
<p><img src="/flashwebsite/32.jpg" alt="" width="699" height="430" /><br />
Now right click between 35 and 45 and 45 &#8211;54 and add a motion tween.<br />
Like this.</p>
<p><img src="/flashwebsite/33.jpg" alt="" width="206" height="129" /></p>
<p>Add the other movie clips to the other key frames. After that you have this.</p>
<p><img src="/flashwebsite/34.jpg" alt="" width="1335" height="120" /><br />
Select your actionsmain layer and in the key frames 45 , 69 , 92 and 115 add a<br />
stop in your action script.<br />
This is to make sure that it doesn&#8217;t loop all the time.<br />
<span style="color: #00cc00;">stop(); </span><br />
And now label the frames.<br />
35 = <span style="color: #00cc00;">home</span><br />
59 = <span style="color: #00cc00;">about</span><br />
82 = <span style="color: #00cc00;">port</span><br />
105 = <span style="color: #00cc00;">contact</span></p>
<p>Now comes the tricky part. All the AS . you need to get this right or we will<br />
get allot of errors. <img src='http://www.webdesigndev.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
All of this will go in the actionsmain layer. . So when the page opens the<br />
buttons are already in pause state.<br />
<span style="color: black;">Code for frame 36</span><span style="color: #00cc00;"><br />
home_mc.gotoAndStop(&#8220;pause&#8221;);//if you hit this frame then the button<br />
will go to the pause state<br />
over1_btn.enabled= false ; //here you say that when you go over that button<br />
it can&#8217;t do anything</span></p>
<p>frame 60<br />
<span style="color: #00cc00;">about_mc.gotoAndStop(&#8220;pause&#8221;);<br />
over2_btn.enabled= false ; </span></p>
<p>frame 83<br />
<span style="color: #00cc00;">port_mc.gotoAndStop(&#8220;pause&#8221;);</span><br />
<span style="color: #00cc00;">over3_btn.enabled= false ;</span></p>
<p>frame 106 <span style="color: #00cc00;"><br />
contact_mc.gotoAndStop(&#8220;pause&#8221;);</span><br />
<span style="color: #00cc00;">over4_btn.enabled= false ;</span></p>
<p>Now we will tell flash were to go when a button is released. And we will give<br />
it a little timeout. If you put in 1000 then that’s 1 second.<br />
So we will give in 500 , that’s a half second.<br />
Code for frame 54<br />
<span style="color: #00cc00;">stop();</span></p>
<p><span style="color: #00cc00;">function moveOn()<br />
{<br />
gotoAndPlay(target);</span></p>
<div id="in_post_ad_middle_1" style="margin: 5px;padding: 0px;"><a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&experiment_id=af_webdesigndev.com1middlepostnewLP" target="_blank" rel="nofollow">
<img src="http://www.webdesigndev.com/expressions_website3.gif" width="300" height="250" alt="create a free website" /></a></div><p>}<br />
setTimeout(this, &#8220;moveOn&#8221;, 500);// this will delay the transition<br />
by 1/2 second<br />
over1_btn.enabled= true ; //this will make sure that the button works again</p>
<p>home_mc.gotoAndPlay(&#8220;h2&#8243;); //and that the button play&#8217;s the rest<br />
of the animation</p>
<p><span style="color: black;">Frame 78 </span><span style="color: #00cc00;"><br />
stop();</span></p>
<p><span style="color: #00cc00;">function moveOn()<br />
{<br />
gotoAndPlay(target); //this is were the flash will go after you clicked a<br />
button </span></p>
<p><span style="color: #00cc00;">}<br />
setTimeout(this, &#8220;moveOn&#8221;, 500);<br />
over2_btn.enabled= true ;<br />
about_mc.gotoAndPlay(&#8220;h2&#8243;);</span></p>
<p><span style="color: black;">Frame 101</span><span style="color: #00cc00;"><br />
stop();</span></p>
<p><span style="color: #00cc00;">function moveOn()<br />
{<br />
gotoAndPlay(target);</span></p>
<p><span style="color: #00cc00;">}<br />
setTimeout(this, &#8220;moveOn&#8221;, 500);<br />
over3_btn.enabled= true ;<br />
port_mc.gotoAndPlay(&#8220;h2&#8243;);</span></p>
<p><span style="color: black;">Frame 124</span><span style="color: #00cc00;"><br />
stop();</span></p>
<p><span style="color: #00cc00;">function moveOn()<br />
{<br />
gotoAndPlay(target);</span></p>
<p><span style="color: #00cc00;">}<br />
setTimeout(this, &#8220;moveOn&#8221;, 500);<br />
over4_btn.enabled= true ;<br />
contact_mc.gotoAndPlay(&#8220;h2&#8243;);</span></p>
<p><span style="color: #00cc00;"><br />
</span><span style="color: black;">T</span><span style="color: black;">his is<br />
what you should have now.</span></p>
<p><img src="/flashwebsite/35.jpg" alt="" width="992" height="77" /></p>
<h2>Step 3 &#8211; Enable and Disable Buttons</h2>
<p>Again make a new symbol , and name it home_mc. Now make 4 layers. Call them left , right , text and actions.</p>
<p>In the text layer type in home and the select that text and press</p>
<p><img src="/flashwebsite/21.jpg" alt="" width="676" height="202" /></p>
<p>F8 to convert it to a movie clip. name this homeText_mc</p>
<p>Now in your movie clip home_mc Add this image. to layers left and right in<br />
the first frame.</p>
<p><img src="/flashwebsite/20.jpg" alt="" width="215" height="492" /></p>
<p>Convert it to a movie clip called indi_mc.</p>
<p>And place them on the side of the text.</p>
<p><img src="/flashwebsite/22.jpg" alt="" width="132" height="49" /></p>
<p>Add a key frame in frame 7 of the layers left and right.</p>
<p>Go back to the second frame and move the indi_mc away from the text by 15<br />
pox each. 1 to the left the other to the right.</p>
<p><img src="/flashwebsite/23.jpg" alt="" width="178" height="51" /></p>
<p>And give them in the first frame 0% alpha. Now copy these 2 frames and paste<br />
them in to frame14.</p>
<p>And give it a between the key frames a motiontween.</p>
<p><img src="/flashwebsite/25.jpg" alt="" width="638" height="58" /><br />
Now give frame 8 a key frame in the layers left , right and actions.</p>
<p>In the actions layer give in <span style="color: #00cc00;">stop();</span> in<br />
the first frame , frame 7 and give frame 1 label <span style="color: #00cc00;">h1</span><br />
, frame7 <span style="color: #00cc00;">pause</span> and frame 8<span><br />
style=&#8217;color:#00CC00&#8242;&gt;h2</span>.</p>
<p>You should have this now.</p>
<p><img src="/flashwebsite/36.jpg" alt="" width="274" height="78" /></p>
<p>Now you have to do the same with the other buttons.</p>
<p>When you have that then go to scene1 and add a folder. And call it buttons.</p>
<p><img src="/flashwebsite/37.jpg" alt="" width="163" height="102" /><br />
And add 8 layers and place them in that folder.</p>
<p>Now give them the names like below.</p>
<p><img src="/flashwebsite/38.jpg" alt="" width="241" height="171" /></p>
<p>Make key frames in these 8 layers . In frame 23.</p>
<p>Now drag the buttons you just made in the right layer. homeB = <span><br />
style=&#8217;color:#00CC00&#8242;&gt;home_mc</span> , aboutB = <span style="color: #00cc00;">about_mc</span><br />
, &#8230;.</p>
<p>And now drag the swirls into position. Select the each and give them these<br />
names and put them in the right layer.</p>
<p><img src="/flashwebsite/44.jpg" alt="" width="386" height="307" /></p>
<p><img src="/flashwebsite/39.jpg" alt="" width="701" height="706" /></p>
<p>Give these movie clips instance names. So that flash knows that you mean them<br />
in the action script.</p>
<p><img src="/flashwebsite/42.jpg" alt="" width="702" height="308" /></p>
<p>Do this for the other movie clips too. Name them the same as the movie clips.</p>
<p>Now we are going to make a button. Like this.</p>
<p><img src="/flashwebsite/40.jpg" alt="" width="159" height="175" /></p>
<p>Drag that button into the layer inviB in scene1.and place it right on top of<br />
the home_mc. Now copy and paste the button 3 more times and place</p>
<p>Them on top of the other 3 movie clips. And name them like below.</p>
<p><img src="/flashwebsite/41.jpg" alt="" width="293" height="254" /><br />
Now with those 4 buttons selected put the alpha to 0%.</p>
<p>Make a new layer on top of the rest and call it buttonactions. And give it<br />
this code.</p>
<p>I<br />
n this code you will say what flash needs to do when you go over , or press ,<br />
&#8230; a movie clip.</p>
<p><span style="color: #00cc00;">//button home_mc//<br />
over1_btn.onRelease = function(){<br />
play();<br />
target=&#8221;home&#8221;;<br />
}<br />
over1_btn.onRollOver = function(){<br />
home_mc.gotoAndPlay(&#8220;h1&#8243;);<br />
}<br />
over1_btn.onRollOut = function(){<br />
home_mc.gotoAndPlay(&#8220;h2&#8243;);<br />
}<br />
over1_btn.onReleaseOutside = function(){<br />
home_mc.gotoAndStop (&#8220;pause&#8221;);<br />
}<br />
//button about_mc//<br />
over2_btn.onRelease = function(){<br />
play();<br />
target=&#8221;about&#8221;;<br />
}<br />
over2_btn.onRollOver = function(){<br />
about_mc.gotoAndPlay(&#8220;h1&#8243;);<br />
}<br />
over2_btn.onRollOut = function(){<br />
about_mc.gotoAndPlay(&#8220;h2&#8243;);<br />
}<br />
over2_btn.onPress = function(){<br />
about_mc.gotoAndStop (&#8220;pause&#8221;);<br />
}</span></p>
<p><span style="color: #00cc00;">//button port_mc//<br />
over3_btn.onRelease = function(){<br />
play();<br />
target=&#8221;port&#8221;;<br />
}<br />
over3_btn.onRollOver = function(){<br />
port_mc.gotoAndPlay(&#8220;h1&#8243;);<br />
}<br />
over3_btn.onRollOut = function(){<br />
port_mc.gotoAndPlay(&#8220;h2&#8243;);<br />
}<br />
over3_btn.onReleaseOutside = function(){<br />
port_mc.gotoAndStop (&#8220;pause&#8221;);<br />
}<br />
//button contact_mc//<br />
over4_btn.onRelease = function(){<br />
play();<br />
target=&#8221;contact&#8221;;<br />
}<br />
over4_btn.onRollOver = function(){<br />
contact_mc.gotoAndPlay(&#8220;h1&#8243;);<br />
}<br />
over4_btn.onRollOut = function(){<br />
contact_mc.gotoAndPlay(&#8220;h2&#8243;);<br />
}<br />
over4_btn.onReleaseOutside = function(){<br />
contact_mc.gotoAndStop (&#8220;pause&#8221;);<br />
}</span></p>
<p>Let’s make the animation when the buttons enter the screen.</p>
<p>Select the topL_mc and place it right above your screen.And place the<br />
buttomL_mc right under it.</p>
<p><img src="/flashwebsite/45.jpg" alt="" width="385" height="361" /></p>
<p>Now add a key frame in frame 33 for those 2 layers .In frame 33 move them on<br />
how they were from the beginning.</p>
<p>Click between frame 23 and 33 and a motiowtween.</p>
<p>Now for the mask. add a key frame in 23 and draw a rectangle that will cover<br />
your buttons.</p>
<p><img src="/flashwebsite/46.jpg" alt="" width="262" height="250" /></p>
<p>Make a key frame in 33 and go back to 23 and place it like this.</p>
<p><img src="/flashwebsite/47.jpg" alt="" width="335" height="427" /></p>
<p>And add a motiontween.</p>
<p>Now for the last piece . The header/logo. You can use any logo or banner you<br />
want . This is to show you how you can tween with AS.</p>
<p>So take the logo and make it a movie clip.</p>
<p>And call it logo_mc</p>
<p><img src="/flashwebsite/43.jpg" alt="" width="387" height="355" /></p>
<p>Make a new layer in scene1. make a key frame in frame 10 and drag Logo_mc<br />
into the stage and place it on the left side.</p>
<p>Take a look on the Y axis.</p>
<p><img src="/flashwebsite/48.jpg" alt="" width="447" height="414" /></p>
<p>Select the logo and press F9 to open Up the actions window. And give this code.</p>
<p>The first part will tell the movie clip where to start. and the second 1 will<br />
say where to stop.</p>
<p><span style="color: #00cc00;">onClipEvent (load) {<br />
//here you say where to start<br />
this._y = -170;<br />
}<br />
onClipEvent (enterFrame) {<br />
//this will tell the As on were to stop the animation. the 25 is what speed<br />
you want it to move.<br />
if (this._y&lt;100) {<br />
this._y += 25;<br />
}</span></p>
<p>}</p>
<p>SO , press Ctrl+enter and you are done.</p>
<p>You should have learned some new but very simple things that you can use to<br />
make your own site. If you feel like this is too much work, you can <a href="http://www.wix.com/amazingwebsites/editoreasy?utm_campaign=af_webdesigndev.com&amp;experiment_id=af_webdesigndev.com" target="_blank">create a free professional flash website with Wix</a>.</p>
<p>Visit later for more <a title="Flash tutorials" href="http://www.webdesigndev.com/flash/learn-how-to-create-a-flash-website">Flash tutorials</a>.</p>
<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.webdesigndev.com/flash/flash-website-tutorial/feed</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: basic
Object Caching 463/489 objects using disk: basic

Served from: www.webdesigndev.com @ 2012-02-12 12:51:14 -->
