<?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>Free Flash Tutorials at FlashMint Tuts</title>
	<atom:link href="http://tuts.flashmint.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tuts.flashmint.com</link>
	<description>Advanced Flash Tutorials and tips</description>
	<lastBuildDate>Wed, 17 Mar 2010 14:16:09 +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 Contact Module Tutorial with AS3</title>
		<link>http://tuts.flashmint.com/creating-contact-module-tutorial-with-as3/</link>
		<comments>http://tuts.flashmint.com/creating-contact-module-tutorial-with-as3/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 13:33:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[contact form]]></category>
		<category><![CDATA[contact module]]></category>
		<category><![CDATA[flash components]]></category>
		<category><![CDATA[flash tutorials overview]]></category>
		<category><![CDATA[flash xml]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=403</guid>
		<description><![CDATA[Do you want to create a Contact Module using popular scripts? In this tutorial, we&#8217;ll create a Advanced Contact Module with ActionScript 3.0 &#8211; XML and PHP. Don&#8217;t worry! You don&#8217;t need to know PHP Script. During the tutorial, I&#8217;ll explain you coding and designing parts of the creation process. Also, we will use XML [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-404" title="preview" src="http://tuts.flashmint.com/wp-content/uploads/preview2.jpg" alt="" width="220" height="137" />Do you want to create a Contact Module using popular scripts? In this tutorial, we&#8217;ll create a Advanced Contact Module with ActionScript 3.0 &#8211; XML and PHP. Don&#8217;t worry! You don&#8217;t need to know PHP Script.  During the tutorial, I&#8217;ll explain you coding and designing parts of the creation process. Also, we will use XML to make an easy upgrade. The Module can be improved and used each project. The Steps are very easy. Just follow the steps carefully and apply them. </p>
<p><span id="more-403"></span></p>
<h3>Step 1: Preparing The Folder</h3>
<p>First, Create a new folder called &#8220;AS3 Contact Module&#8221; Open the new blank projects like the following:</p>
<p>1. Contact.fla &#8211; Flash Project</p>
<p>2. Contact.html &#8211; HTML Page to show swf file.</p>
<p>3. Contact.swf &#8211; Main Swf File</p>
<p>4. contactImg.jpg &#8211; The image of The Module</p>
<p>5. ContactPHP &#8211; PHP Script</p>
<p>6. ContactXML &#8211; XML Script</p>
<p><img class="size-full wp-image-408 alignnone" src="http://tuts.flashmint.com/wp-content/uploads/17.jpg" alt="" width="513" height="113" /></p>
<h3>Step 2: Flash Project</h3>
<p>Open a new AS3 Project File. You can see the properties of the project below.</p>
<p><img class="alignnone size-full wp-image-411" src="http://tuts.flashmint.com/wp-content/uploads/24.jpg" alt="" width="274" height="354" /></p>
<h3>Step 3: Background Properties</h3>
<p>Select Rectangle Tool (or Press &#8220;R&#8221;) and create a rectangle without outline. The size of the rectangle can be changed. Now, Crop the rectangle like the following and reduce the alpha value to 20. Align it at the top of the module.</p>
<p><img class="alignnone size-full wp-image-412" src="http://tuts.flashmint.com/wp-content/uploads/34.jpg" alt="" width="547" height="305" /></p>
<h3>Step 4: XML Text Fields</h3>
<p>Create 2 dynamic texts to type the information of the module. They use XML File to call texts.  You can see their instance names below. I&#8217;ll give the actionscript explanations at the end of the designing.</p>
<p><img class="alignnone size-full wp-image-413" src="http://tuts.flashmint.com/wp-content/uploads/44.jpg" alt="" width="714" height="411" /></p>
<h3>Step 5: Import The Image</h3>
<p>Go to &#8220;Insert &gt; New Symbol&#8221;. Create a new blank MovieClip. Move it to the stage from library. Apply the properties like the following.</p>
<p><img class="alignnone size-full wp-image-414" src="http://tuts.flashmint.com/wp-content/uploads/55.jpg" alt="" width="720" height="413" /></p>
<h3>Step 6: Contact Form</h3>
<p>Now, We can start to create contact form. Let&#8217;s start with the background of the input text. Press &#8220;R (Rectangle Tool)&#8221; and draw a shape. The size of the shape is 200&#215;20. Then fill the shape with this colours: Main Color: #252525, Outline Color: #333333. If you want, you can add a drop shadow effect.</p>
<p><img class="alignnone size-full wp-image-415" src="http://tuts.flashmint.com/wp-content/uploads/64.jpg" alt="" width="708" height="411" /></p>
<h3>Step 7: Input Texts</h3>
<p>Input text allows you to type text and show them. Therefore, we must use them in our contact form. Create 4 input texts and 1 dynamic text. Align them according to the backgrounds. You can see the properties below.</p>
<p><img class="alignnone size-full wp-image-416" src="http://tuts.flashmint.com/wp-content/uploads/74.jpg" alt="" width="716" height="416" /></p>
<h3>Step 8: Send Button</h3>
<p>To use &#8220;Submit Function&#8221; we must create a button. You can use same background to create it. Use a static text to show &#8220;SEND&#8221; text. Because we will not change it.</p>
<p><img class="alignnone size-full wp-image-417" src="http://tuts.flashmint.com/wp-content/uploads/82.jpg" alt="" width="712" height="411" /></p>
<h3>Step 9: Coding The Design</h3>
<p>We have just finished the designing.I will explain the actionscript in the code area. Now, We can start to write the codes. Let&#8217;s start with XML Actions. Type these codes to the first frame.</p>
<pre>/*To Define The Main Varibles*/
var urlLoader:URLLoader = new URLLoader();
var imgLoader:Loader = new Loader();
var loadFunction:URLLoader=new URLLoader  ;

/*XML Request*/
function XMLFunction(XMLPath:String):void {
    urlLoader.load(new URLRequest(XMLPath));
	urlLoader.addEventListener(Event.COMPLETE, onSuccess);
}
//The Name of the XML File
XMLFunction("ContactXML.xml");

/*XML - Flash Actions*/
//We'll define "info, title and image" varibles to use them in XML File.
function onSuccess(e:Event):void {
	var xml:XML=new XML(e.target.data);
	contactInfo.htmlText=xml.info;//We use HTML to show any type of texts
	contactInfo.autoSize=TextFieldAutoSize.LEFT;//AutoSize-Left
	contactTitle.htmlText=xml.title;
	contactTitle.autoSize=TextFieldAutoSize.LEFT;
    imgLoader.load(new URLRequest(xml.@image));
	imageMc.addChild(imgLoader);
}
</pre>
<h3>Step 10: Coding The Design</h3>
<p>To show and hide input text. The codes are same but we have to change them because we want to show different text on the input texts.</p>
<pre>/*Focus In - Focus Out*/
/*An object dispatches a FocusEvent object when the user changes the focus
from one object in the display list to another.*/

//Name Text Actions
nameText.text="NAME";
nameText.addEventListener(FocusEvent.FOCUS_IN, focusInName);
nameText.addEventListener(FocusEvent.FOCUS_OUT, focusOutName);

function focusInName(evt:Event) {
	if (nameText.text=="NAME") {
		nameText.text="";
	}
}

function focusOutName(evt:Event) {
	if (nameText.text=="") {
		nameText.text="NAME";
	}
}

//E-Mail Text Actions
emailText.text="E-MAIL";

emailText.addEventListener(FocusEvent.FOCUS_IN, focusInEmail);
emailText.addEventListener(FocusEvent.FOCUS_OUT, focusOutEmail);

function focusInEmail(evt:Event) {
	if (emailText.text=="E-MAIL") {
		emailText.text="";
	}
}

function focusOutEmail(evt:Event) {
	if (emailText.text=="") {
		emailText.text="E-MAIL";
	}
}

//Subject Functions
subjectText.text="SUBJECT";

subjectText.addEventListener(FocusEvent.FOCUS_IN, focusInSubject);
subjectText.addEventListener(FocusEvent.FOCUS_OUT, focusOutSubject);

function focusInSubject(evt:Event) {
	if (subjectText.text=="SUBJECT") {
		subjectText.text="";
	}
}

function focusOutSubject(evt:Event) {
	if (subjectText.text=="") {
		subjectText.text="SUBJECT";
	}
}

//Message Functions
messageText.text="MESSAGE";

messageText.addEventListener(FocusEvent.FOCUS_IN, focusInMessage);
messageText.addEventListener(FocusEvent.FOCUS_OUT, focusOutMessage);

function focusInMessage(evt:Event) {
	if (messageText.text=="MESSAGE") {
		messageText.text="";
	}
}

function focusOutMessage(evt:Event) {
	if (messageText.text=="") {
		messageText.text="MESSAGE";
	}
}
</pre>
<h3>Step 11: Coding The Design</h3>
<p>To communicate between Flash and PHP.</p>
<pre>/*/PHP - Flash Actions/*/

//Make a PHP Script Request to Post to the server

var urlRequest:URLRequest=new URLRequest("ContactPHP.php"); //The Name of the PHP Script
urlRequest.method=URLRequestMethod.POST;

//Send Button
sendBtn.addEventListener(MouseEvent.CLICK, SubmitFunction);

/*Text Field Validation*/
function SubmitFunction(e:MouseEvent):void {
	if (nameText.text == "NAME" || emailText.text == "E-MAIL" ||
	subjectText.text == "SUBJECT" || messageText.text == "MESSAGE" ) {
		resultText.text="PLEASE FILL OUT ALL REQUIRED FIELDS";

	} else if ( !emailValidate(emailText.text) ) {
		resultText.text="VALID E-MAIL ADDRESS.";//If E-Mail field is empty the e-mail will not be sent.
	} else {
		resultText.text="SENDING...";//If everything is correct the message'll be sent.

		var dataEmail:String = "name=" + nameText.text
		   + "&amp;email=" + emailText.text
		   + "&amp;subject=" + subjectText.text
		   + "&amp;message=" + messageText.text;
</pre>
<h3>Step 12: Coding The Design</h3>
<p>E-Mail Validation Actions.</p>
<pre>function emailValidate(s:String):Boolean {
	var p:RegExp=/(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
	var r:Object=p.exec(s);
	if (r==null) {
		return false;
	}
	return true;
}
</pre>
<h3>Step 13: Coding The Design</h3>
<p>I&#8217;m going on with the URL Actions.</p>
<pre>/*URL Actions*/

var URLvariables:URLVariables=new URLVariables(dataEmail);

URLvariables.dataFormat=URLLoaderDataFormat.TEXT;
urlRequest.data=URLvariables;
loadFunction.load(urlRequest);
loadFunction.addEventListener(Event.COMPLETE, responseFunction );
	}
}

/*Status of the E-Mail*/

function responseFunction(e:Event):void {
	var loader:URLLoader=URLLoader(e.target);
	var emailStatus=new URLVariables(loader.data).success;
	//If E-Mail is sent successfully, the visitor'll see this message.
	if (emailStatus=="yes") {
		resultText.text="THANK YOU! YOUR MESSAGE WAS SENT SUCCESSFULLY.";
		//If E-Mail can not be sent, the visitor'll see this message.
	} else {
		resultText.text="AN ERROR OCCURED!";
	}
}
</pre>
<h3>Step 14: Creating XML File</h3>
<p>To show the text on the Flash, we must create a XML File. Open XML File you saved and type these codes. You can change the information.</p>
<p><img class="alignnone size-full wp-image-418" src="http://tuts.flashmint.com/wp-content/uploads/92.jpg" alt="" width="783" height="227" /></p>
<h3>Step 15: Creating PHP File</h3>
<p>To send visitor information you have to have a e-mail account. Open PHP Script you saved. Change the &#8220;emailAddress and siteName&#8221; with yours. The PHP Script contains an automatic response system.</p>
<pre>&lt;?php

//Type the receiever's e-mail address
$emailAddress = "info@email.com";
//Type your Site Name
$siteName = "Company Name";

$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
	$sender = $contact_email;
	$receiver = $emailAddress;
	$client_ip = $_SERVER['REMOTE_ADDR'];

	$email_body = "The Name Of The Sender: $contact_name \nEmail: $sender \n\nSubject: $contact_subject
\n\nMessage: \n\n$contact_message \n\nIP ADDRESS: $client_ip \n\n$siteName";

	$emailAutoReply = "Hi $contact_name, \n\nWe have just received your E-Mail. We will get
in touch in a few days. Thank you!  \n\n$siteName ";

	$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
	$autoReply = "From: $receiver\r\n" . "Reply-To: $receiver \r\n" . "X-Mailer: PHP/" . phpversion();

	mail( $sender, "Auto Reply: $contact_subject", $emailAutoReply, $autoReply );

	if( mail( $receiver, "New E-Mail - $contact_subject", $email_body, $extra ) )
	{
		echo "success=yes";
	}
	else
	{
		echo "success=no";
	}
}

?&gt;
</pre>
<h3>Conclusion</h3>
<p>Congrulations!You&#8217;re done! You can test your movie. You have created a contact module with ActionScript 3.0, XML and PHP. Everything is ready. You must only send the folder to your server and start to use.</p>
<p><strong>Here&#8217;s how your new amazing contact form should look:</strong></p>
<p><img class="alignnone size-full wp-image-424" src="http://tuts.flashmint.com/wp-content/uploads/contact-screenthos.jpg" alt="" width="701" height="396" /></p>
<p>You can also <strong>check the form in action</strong> <a href="http://tuts.flashmint.com/wp-content/uploads/contact-form/Contact.html" target="_blank">here</a>.</p>
<p>If you have any question, please leave a reply here. I hope you enjoyed this tutorial and thanks for reading!</p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/creating-contact-module-tutorial-with-as3/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/creating-contact-module-tutorial-with-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating A Simple XML Gallery in ActionScript3</title>
		<link>http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/</link>
		<comments>http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 11:08:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[flash tutorial]]></category>
		<category><![CDATA[photo gallery]]></category>
		<category><![CDATA[xml gallery]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=192</guid>
		<description><![CDATA[In this tutorial we will show you how to create a simple XML image gallery in ActionScript 3. The advantage of XML-based photo gallery is obvious – instead of editing the FLA file manually every time you want to add an extra image, you can just edit an XML file. The gallery we’re going to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-435" src="http://tuts.flashmint.com/wp-content/uploads/gallery1.jpg" alt="" width="220" height="90" />In this tutorial we will show you how to create a <strong>simple <a href="http://www.flashmint.com/show-tag-gallery.html">XML image gallery</a> in ActionScript 3</strong>. The advantage of <a href="http://www.flashmint.com/show-tag-gallery.html">XML-based photo gallery</a> is obvious – instead of editing the FLA file manually every time you want to add an extra image, you can just edit an XML file. The gallery we’re going to create is really primitive, but it’s enough to give you the basic understanding of the principles of retrieving XML data in Flash. As always, this is going to be easy and fun!<br />
<span id="more-192"></span></p>
<p>To follow this tutorial you need Flash CS3 or greater, because we are using ActionScript 3.0.</p>
<p><strong>Outline:</strong> <em>we will resize our images in Photoshop, secondly we are going to use any text editor or Dreamweaver to write an XML file, and then we will go into Flash and do some ActionScripting in order to load our gallery.</em></p>
<p>The size of our gallery will be 800X450 which means that the max size of image can be 420 by height and 770 by width (if we want to make a 15px marging between the image and the edge of the gallery). You can set the size of the image anywhere between these. For this tutorial I recommend you to save images as 1.jpg, 2.jpg and so on.</p>
<p>Important thing to remember is that you should save your XML file and .fla file in the same folder with the images. So create a folder on your computer and name it, let us say, “XML flash gallery” and put the images you are going to use into this folder. It’s important to keep all files within the same folder because the XML file will reference the images while Flash file will reference the XML file.</p>
<p>Now that our images are ready, let’s write an XML file. As I said you can use any source code editor like DreamWeaver or Notepad ++ (that will be probably a better solution for beginner users) or a basic text editor like Notepad. I will use Notepad for this lesson. So, open a blank  document and save it as an .xml file named ImageGal.xml. Be sure to save it in our “XML flash gallery” folder because it’s really important. When you are done, type the next line in your new document:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=@utf-8<span class="st0">&quot;?&gt;</span></span></pre></div></div>
<p>This is just a doc type definition. If you use Dreamweaver, you don’t have to enter this line, you can just set the type of the doc you are going to create as XML and this line will be filled in automatically.</p>
<p>The beauty of XML is that you can make up your own tags. If you are familiar with HTML coding, you will see that XML uses similar signs, like angle brackets, opening and closing tags, etc. But while HTML uses a fixed number of tags, XML enables you to write your own tags. To learn more about XML data, read these tutorials:</p>
<ul>
<li><a href="http://www.kirupa.com/web/xml/XMLmanageData3.htm">Introduction to XML in Flash</a></li>
<li><a href="http://www.kirupa.com/net/writingXML_pg1.htm">Writing/Saving XML files</a></li>
<li><a href="http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm">Using XML in Flash CS3/AS3</a></li>
</ul>
<p><span style="text-decoration: underline;"> </span>Let’s create our first tag, which will look like this:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><ol class="xml" style="font-family:monospace;"><li class="li1"><div class="de1"><span class="sc3"><span class="re1">&lt;imageFolder<span class="re2">&gt;</span></span></span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="sc3"><span class="re1">&lt;/imageFolder<span class="re2">&gt;</span></span></span></div></li>
</ol></div></div>
<p>It’s not hard to guess what this tag means, is it? We are going to organize our image gallery data. We’ve just marked a “container” for our images and now let’s create the first “child” in it:</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><div class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>1.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
<span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span></div></div></div>
<p>As you see, our image container has 3 pieces of information in it, which are image URL, image width and image height respectively. Notice that we didn’t write the address of the image file within the <em>imgURL</em> tag: because we saved our XML file right in the same folder as all of our images, we can just immediately reference the file name. As for the other two tags, you can grab the image width and height from the file properties window.</p>
<p>Now you can duplicate this <em>&lt;image&gt;</em> tag as many times as many images you have, filling necessary information and our XML file is actually written. Here is what I’ve got as a result:</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><div class="xml" style="font-family:monospace;"><span class="sc3"><span class="re1">&lt;?xml</span> <span class="re0">version</span>=<span class="st0">&quot;1.0&quot;</span> <span class="re0">encoding</span>=@utf-8<span class="st0">&quot;?&gt;</span></span><br />
<br />
<span class="sc3"><span class="re1">&lt;imageFolder<span class="re2">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>1.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>2.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>3.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>4.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>5.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>6.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;image<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgURL<span class="re2">&gt;</span></span></span>7.jpg<span class="sc3"><span class="re1">&lt;/imgURL<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgW<span class="re2">&gt;</span></span></span>525<span class="sc3"><span class="re1">&lt;/imgW<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;imgH<span class="re2">&gt;</span></span></span>420<span class="sc3"><span class="re1">&lt;/imgH<span class="re2">&gt;</span></span></span><br />
&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;/image<span class="re2">&gt;</span></span></span><br />
<br />
<span class="sc3"><span class="re1">&lt;/imageFolder<span class="re2">&gt;</span></span></span></div></div></div>
<p>Now we can jump into Flash and start building our image gallery there. However, in fact we won’t create anything special in Flash, we will make just one symbol and the rest is all coding. So, open your Adobe Flash CS3 or CS4 and create a new <em><strong>Actionscript 3.0</strong></em> Flash file.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/11.jpg"><img class="size-full wp-image-193 aligncenter" title="1" src="http://tuts.flashmint.com/wp-content/uploads/11.jpg" alt="" width="600" height="464" /></a></p>
<p>As I mentioned in the beginning, the size of our gallery is going to be 800&#215;450, so let’s set necessary dimensions and make the stage color black via the document properties tab (see the screenshot below).</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/21.jpg"><img class="size-full wp-image-196 aligncenter" title="2" src="http://tuts.flashmint.com/wp-content/uploads/21.jpg" alt="" width="600" height="459" /></a></p>
<p>Now find a Rectangle tool on the toolbar and draw a rectangle of any size. Then select your new object and go to the properties panel. Set the dimensions of the rectangle to <em><strong>800X450</strong></em>, just like our stage.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/31.jpg"><img class="size-full wp-image-197 aligncenter" title="3" src="http://tuts.flashmint.com/wp-content/uploads/31.jpg" alt="" width="600" height="351" /></a></p>
<p>Now comes an important moment: press <strong>F8</strong> to convert the object into symbol. Let’s name it <strong>Base</strong>. Please make sure it’s a <strong><em>Movie Clip</em></strong> and that the registration point is in the <strong><em>top left corner</em></strong>. Give this layer name Base and same goes for its <em>Instance Name</em>.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/41.jpg"><img class="size-full wp-image-198 aligncenter" title="4" src="http://tuts.flashmint.com/wp-content/uploads/41.jpg" alt="" width="600" height="340" /></a></p>
<p>Now we are completely ready to <strong>process to the coding</strong>. Create a new layer and name it AS. Then select the first keyframe of this layer and hit <strong>F9</strong> to open the ActionScript window.</p>
<p>Now copy the following chunk of code and paste it into your Actions window. Save the file. If that doesn’t make sense to you yet, don’t worry – a detailed line-by-line explanation goes further.</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw2">var</span> xmlRequest<span class="sy0">:</span><a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span class="kw5">URLRequest</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span class="kw5">URLRequest</span></a><span class="br0">&#40;</span><span class="st0">&quot;ImageGal.xml&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> xmlLoader<span class="sy0">:</span><a href="http://www.google.com/search?q=urlloader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlloader.html"><span class="kw5">URLLoader</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=urlloader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlloader.html"><span class="kw5">URLLoader</span></a> <span class="br0">&#40;</span>xmlRequest<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> imgData<span class="sy0">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span class="kw5">XML</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> imageLoader<span class="sy0">:</span><a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span class="kw5">Loader</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> rawImage<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> rawH<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> rawW<span class="sy0">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span class="kw5">String</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw2">var</span> imgNum<span class="sy0">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a> = <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> checkTime<span class="sy0">:</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html"><span class="kw5">Timer</span></a> = <span class="kw1">new</span> <a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html"><span class="kw5">Timer</span></a><span class="br0">&#40;</span>100<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="kw2">var</span> numberOfChildren<span class="sy0">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">xmlLoader<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span class="kw5">Event</span></a><span class="sy0">.</span><span class="kw8">COMPLETE</span><span class="sy0">,</span> xmlLoadedF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">Base<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span> nextImgF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">Base<span class="sy0">.</span><span class="kw7">buttonMode</span> = <span class="kw1">true</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw3">function</span> xmlLoadedF<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span class="kw5">Event</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	checkTime<span class="sy0">.</span><span class="kw7">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	checkTime<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER</span><span class="sy0">,</span> checkF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imgData = <span class="kw1">new</span> <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span class="kw5">XML</span></a><span class="br0">&#40;</span>event<span class="sy0">.</span><span class="kw7">target</span><span class="sy0">.</span><span class="kw7">data</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw3">function</span> checkF<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	<span class="kw1">if</span><span class="br0">&#40;</span>imgNum ==0<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>imgNum <span class="sy0">&lt;</span> numberOfChildren<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		imageLoader<span class="sy0">.</span><span class="kw7">unload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		imageLoader<span class="sy0">.</span><span class="kw7">unload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		imgNum = <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">	<span class="kw3">function</span> packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	checkTime<span class="sy0">.</span><span class="kw7">removeEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER</span><span class="sy0">,</span> checkF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawImage = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgURL<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	numberOfChildren = imgData<span class="sy0">.*.</span><span class="kw7">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawW = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgW<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawH = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgH<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader = <span class="kw1">new</span> <a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span class="kw5">Loader</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">load</span><span class="br0">&#40;</span><span class="kw1">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span class="kw5">URLRequest</span></a><span class="br0">&#40;</span>rawImage<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	Base<span class="sy0">.</span><span class="kw7">addChild</span><span class="br0">&#40;</span>imageLoader<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">x</span> = <span class="br0">&#40;</span><span class="kw7">stage</span><span class="sy0">.</span><span class="kw7">stageWidth</span> <span class="sy0">-</span> <a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="br0">&#40;</span>rawW<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">/</span><span class="nu0">2</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">y</span> = <span class="br0">&#40;</span><span class="kw7">stage</span><span class="sy0">.</span><span class="kw7">stageHeight</span> <span class="sy0">-</span> <a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="br0">&#40;</span>rawH<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">/</span><span class="nu0">2</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="kw3">function</span> nextImgF<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	checkTime<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER</span><span class="sy0">,</span> checkF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imgNum<span class="sy0">++;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>Virtually our xml flash gallery is done! Go to <strong>Control =&gt; Test Movie</strong> or simply press <strong>Ctrl+Enter</strong> to see the resulting gallery. It should look like this:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_1_88608085"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/1.swf"
			name="fm_1_88608085"
			width="400"
			height="300">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>We’ve just created a simple flash gallery that uses an XML file to render some data. Now let’s look into greater detail at the code you’ve pasted a minute earlier.</p>
<p>The first thing we need to create sort of a container where we will store the primary information about our XML file. Using a professional language, we need to declare a variable.</p>
<p><strong>var xmlRequest:URLRequest = new URLRequest(&#8220;ImageGal.xml&#8221;);</strong> &#8211; here we created an XML loading request</p>
<p><strong>var xmlLoader:URLLoader = new URLLoader (xmlRequest);</strong> &#8211; the URLLoader variable actually loads the aforesaid URL  &#8220;ImageGal.xml&#8221;. In other words, it’s loading our XML file.</p>
<p>Our next step is adding an event listener to the URL loader which basically says Flash to load the XML data immediately after the XML file is loaded (line 13 of our source code):</p>
<p><strong>xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);</strong> &#8211; this line means that as soon as the file ImageGal.xml is loaded, the function xmlLoadedF will be executed. We will need one more variable in order to create that function (see the 3d line of the source code):</p>
<p><strong>var imgData:XML;</strong></p>
<p>The function xmlLoadedF starts on the line 17 and looks like this:</p>
<p><strong>function xmlLoadedF(event:Event):void{</strong></p>
<p><strong>imgData = new XML(event.target.data);</strong></p>
<p><strong>}</strong></p>
<p>To see what’s going on, let’s trace the variable imgData by typing <strong>trace(imgData);</strong> right under the line <strong>imgData = new XML(event.target.data);</strong> Then just press Ctrl+Enter.</p>
<p>You will get the following result:</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/71.jpg"><img class="size-full wp-image-241 aligncenter" title="7" src="http://tuts.flashmint.com/wp-content/uploads/71.jpg" alt="" width="600" height="342" /></a></p>
<p>We see that our output window is showing us right the same data we’ve typed in our XML file. Everything’s working and you can now delete the trace line.</p>
<p>Our next step is actually to define the first image in our XML file on the stage here in a Flash file so we could view the image. To do this, we should add several new variables first (Line 4 and 5 of the source code):</p>
<p><strong>var imageLoader:Loader;</strong> &#8211; here Loader is an AS3 class responsible for loading an object;</p>
<p><strong>var rawImage:String;</strong> &#8211; this is a variable of <em>String</em> type, which is, in other words, a line of code containing some text data;</p>
<p><strong>var imgNum:Number = 0;</strong> &#8211; variable of <em>Number</em> type is responsible for keeping numerical values, both whole and fractional numbers.</p>
<p>Now we need to add some code within the <em><strong>xmlLoadedF</strong></em> function to make the image displayed (line 38 of the source code):</p>
<p><strong>rawImage = imgData.image[imgNum].imgURL;</strong> &#8211; as you remember, we’ve declared the <em><strong>rawImage</strong></em> variable above and it’s a string, this line defines the value of rawImage.</p>
<p>Another variable we’ve just declared is <em><strong>imageLoader</strong></em> and now we have to initialize this object as a Loader (line 42 of the source code):</p>
<p><strong>imageLoader = new Loader;</strong></p>
<p>Now that our value is initialized, let’s populate its property:</p>
<p><strong>imageLoader.load(new URLRequest(rawImage));</strong> &#8211; in this line, we call our <em>imageLoader</em> object&#8217;s load method. The load method takes a URLRequest object as its argument, so we create a new URLRequest object, and since its constructor accepts a string to create the rawImage request, I pass it our <em><strong>rawImage</strong></em> argument that function <em>xmlLoadedF</em> takes.</p>
<p>Here goes the next line of code:</p>
<p><strong>Base.addChild(imageLoader);</strong> &#8211; with this line we add our <em>imageLoader</em> object, which holds a loaded image, onto the stage.</p>
<p>Now when you click Ctrl+Enter you should have the first image displayed:</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/52.jpg"><img class="size-full wp-image-243 aligncenter" title="5" src="http://tuts.flashmint.com/wp-content/uploads/52.jpg" alt="" width="600" height="384" /></a></p>
<p>Notice that the image is aligned at the top left corner because it makes a start from the registration point of our <strong><em>Base</em></strong> movie clip, which we set up as the top left corner, as you remember.</p>
<p>Now we have to declare two new variables (lines 6 and 7 of the source code):</p>
<p><strong>var rawH:String;</strong></p>
<p><strong>var rawW:String;</strong></p>
<p>As you might guess, these are responsible for the image height and width respectively.</p>
<p>Now let’s give Flash a hint at where it should take info about the image width and height, and of course, we will refer to our XML file:</p>
<p><strong>rawW = imgData.image[imgNum].imgW;</strong></p>
<p><strong>rawH = imgData.image[imgNum].imgH;</strong></p>
<p>Next step is to add the code necessary to center this image (lines 45 and 46 of the source code):</p>
<p><strong>imageLoader.x = (stage.stageWidth &#8211; Number(rawW)) /2;</strong></p>
<p><strong>imageLoader.y = (stage.stageHeight &#8211; Number(rawH)) /2;</strong></p>
<p>Notice that we converted <em><strong>raw</strong></em> here into a Number, although initially we defined it as String. We need this because Flash can’t do Math with strings, we have to operate numbers. In order to enable Flash to calculate the “x” and “y”  parameters we just point out that <em>rawW</em> and <em>rawH</em> are numbers in this case.</p>
<p>Now you can test the movie by clicking Ctrl+Enter and you’ll see that the image is now centered:</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/61.jpg"><img class="size-full wp-image-247 aligncenter" title="6" src="http://tuts.flashmint.com/wp-content/uploads/61.jpg" alt="" width="600" height="383" /></a></p>
<p>Let’s go further and make our image switch to the next one when we click on it. First, we need to add an event listener to our <em>Base</em> movie clip so that when it’s clicked next XML item is loading. Here it is (see line 14 of the source code):</p>
<p><strong>Base.addEventListener(MouseEvent.CLICK, nextImgF);</strong></p>
<p>Because Base is a movie clip, when you hover the mouse over it you won’t get that index finger cursor displayed. But using a small trick we can enable that finger to let users know the area is clickable. All we need to do is apply a button mode to our movie clip (line 15):</p>
<p><strong>Base.buttonMode = true;</strong></p>
<p>You will be able to preview this effect as soon as we define the function<em><strong> nextImgF</strong></em>. We will get back to this function later right after we write some more code necessary for its implementation.</p>
<p>The code we’ve written so far allows us to load data from our XML file using the <em><strong>xmlLoadedF</strong></em> function. However, this is not enough for our image gallery and we need a few more things to add to our code block. And a couple of new variables go first (lines 10 and 11 of the source code):</p>
<p><strong>var checkTime:Timer = new Timer(100);</strong> &#8211; this variable contains info about <em>timer</em> which is going to continuously check the number of the image, so the program could know when the image is clicked and when it has to go ahead. In our case the timer will cycle every one tenth of a second infinitely.</p>
<p><strong>var numberOfChildren:Number;</strong> &#8211; this variable of a Number type contains the number of children in the XML document. So far Flash only knows one child, var imgNum:Number = 0. We need to fix that.</p>
<p>Let’s define what <em><strong>numberOfChildren</strong></em> should be equal to:</p>
<p><strong>numberOfChildren = imgData.*.length();</strong> &#8211; <strong>*</strong> Symbol here means “any child inside the imgData”.</p>
<p>Now let’s actually start our timer. Because we need it to start as soon as our XML file is loaded, we will add some details for the <em>xmlLoadedF</em> function which, as you remember, gets executed right after the XML file is loaded (line 18, 19):</p>
<p><strong>checkTime.start();</strong> &#8211; with this line we tell our timer to start and execute every tenth of a second. And in order to tell the timer what it should execute every one tenth of a second, let’s add an event listener:</p>
<p><strong>checkTime.addEventListener(TimerEvent.TIMER, checkF);</strong> &#8211; as you see, every tenth of a second our timer will call the function <strong><em>checkF</em></strong>.</p>
<p>We will define this function in a moment. Now I want to point out you that the <em>xmlLoadedF</em> function is called only once, and what we want is to make Flash reload image each time the <em>imgNum</em> changes.  That’s why we need to remove a junk of code from xmlLoadedF and put it into function that will be continuously recalled as we wish. Let’s create such function and call it <strong><em>packetF</em></strong> (line 36 of the source code):</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><ol start="36"><li class="li1"><div class="de1"><span class="kw3">function</span> packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">	checkTime<span class="sy0">.</span><span class="kw7">removeEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html"><span class="kw5">TimerEvent</span></a><span class="sy0">.</span><span class="kw8">TIMER</span><span class="sy0">,</span> checkF<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawImage = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgURL<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	numberOfChildren = imgData<span class="sy0">.*.</span><span class="kw7">length</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawW = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgW<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	rawH = imgData<span class="sy0">.</span>image<span class="br0">&#91;</span>imgNum<span class="br0">&#93;</span><span class="sy0">.</span>imgH<span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader = <span class="kw1">new</span> <a href="http://www.google.com/search?q=loader%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:loader.html"><span class="kw5">Loader</span></a><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">load</span><span class="br0">&#40;</span><span class="kw1">new</span> <a href="http://www.google.com/search?q=urlrequest%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlrequest.html"><span class="kw5">URLRequest</span></a><span class="br0">&#40;</span>rawImage<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	Base<span class="sy0">.</span><span class="kw7">addChild</span><span class="br0">&#40;</span>imageLoader<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">x</span> = <span class="br0">&#40;</span><span class="kw7">stage</span><span class="sy0">.</span><span class="kw7">stageWidth</span> <span class="sy0">-</span> <a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="br0">&#40;</span>rawW<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">/</span><span class="nu0">2</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	imageLoader<span class="sy0">.</span><span class="kw7">y</span> = <span class="br0">&#40;</span><span class="kw7">stage</span><span class="sy0">.</span><span class="kw7">stageHeight</span> <span class="sy0">-</span> <a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span class="kw5">Number</span></a><span class="br0">&#40;</span>rawH<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">/</span><span class="nu0">2</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>Look above at the line 37: we removed the event listener so that checking function would stop running as soon as function <em>packetF</em> is called.</p>
<p>Now let’s get back to the <em><strong>checkF</strong></em> function. We are going to put some <strong>if</strong> and <strong>else</strong> statements into this function to let the code decide between several potential paths (line 23 of the source code):</p>
<p><strong>if(imgNum ==0){</strong></p>
<p><strong>packetF(); &#8211; </strong>the condition here is that if the <em><strong>imgNum</strong></em> equals <em><strong>0</strong></em>, the function <em><strong>packetF</strong></em> should be executed.</p>
<p>Another condition we&#8217;ll state is that if the image number is less than number of children in the XML file, <em>imageLoader</em> object should unload, as we don’t want all the stack of image to appear on the stage:</p>
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><ol start="26"><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="kw1">else</span> <span class="kw1">if</span><span class="br0">&#40;</span>imgNum <span class="sy0">&lt;</span> numberOfChildren<span class="br0">&#41;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		imageLoader<span class="sy0">.</span><span class="kw7">unload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div></div>
<p>And the last part, in which we will define that in all other cases the program should unload the image loader, set the imgNum to 0 and execute function packetF:</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><ol start="29"><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">		imageLoader<span class="sy0">.</span><span class="kw7">unload</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		imgNum = <span class="nu0">0</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">		packetF<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">	<span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li></ol></pre></div></div>
<p>Finally we can define <em><strong>nextImgF</strong></em> function (line 50 of the source code):</p>
<p><strong>function nextImgF(event:MouseEvent):void{</strong></p>
<p><strong>checkTime.addEventListener(TimerEvent.TIMER, checkF);</strong> &#8211; we need to recover an event listener for our timer, so it could start calling the conditional function <em>packetF</em>.</p>
<p><strong>imgNum++;</strong> &#8211; with this line we set function to take the imgNum and add one number to it.</p>
<p><strong>}</strong></p>
<p>And here the grand moment comes – <strong> </strong><strong>our simple <a href="http://www.flashmint.com/show-tag-gallery.html">XML image gallery</a> is done!</strong> I&#8217;ve included seven images to my example photo slideshow, but you can add as many images as you want. Try how easy it is to edit an <a href="http://www.flashmint.com/show-tag-gallery.html">XML gallery</a> &#8211; you just enter necessary data in your XML document and all changes automatically appear in your <em>.swf</em> file. So enjoy and good luck in your projects!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://tuts.flashmint.com/wp-content/uploads/1.swf" /><embed type="application/x-shockwave-flash" width="600" height="400" src="http://tuts.flashmint.com/wp-content/uploads/1.swf"></embed></object></p>
<p><strong><br />
</strong></p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/creating-a-simple-xml-gallery-in-actionscript3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash MP3 Music Player Tutorial &#8211; AS3</title>
		<link>http://tuts.flashmint.com/flash-mp3-music-player-tutorial/</link>
		<comments>http://tuts.flashmint.com/flash-mp3-music-player-tutorial/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 11:34:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[flash component]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[mp3 player]]></category>
		<category><![CDATA[music player]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=266</guid>
		<description><![CDATA[In this tutorial, you&#8217;ll learn how to create a music player with ActionScript 3.0 and XML. In a step-by-step guide I will explain both designing and coding part of the creation process. You will also learn how to add some effects to the player buttons, as well as how to create a right-click menu and XML [...]]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="5" cellpadding="0" width="100%">
<tbody>
<tr>
<td><a href="http://tuts.flashmint.com/wp-content/uploads/music-player.jpg"><img class="alignnone size-full wp-image-352" title="music-player" src="http://tuts.flashmint.com/wp-content/uploads/music-player.jpg" alt="" width="137" height="181" /></a></td>
<td valign="top">In this tutorial, you&#8217;ll learn how to create a <strong>music player</strong> with ActionScript 3.0 and XML. In a step-by-step guide I will explain both designing and coding part of the creation process. You will also learn how to add some effects to the player buttons, as well as how to create a right-click menu and XML file which you can use to change and update your audio data at ease. By means of this tutorial you will be able to create a full-blown music player in a matter of minutes. So read on and enjoy!</td>
</tr>
</tbody>
</table>
<p><span id="more-266"></span><br />
Here is how it should looks like:<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="200" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://tuts.flashmint.com/wp-content/uploads/MusicPlayer.swf" /><embed type="application/x-shockwave-flash" width="300" height="200" src="http://tuts.flashmint.com/wp-content/uploads/MusicPlayer.swf"></embed></object></p>
<h3>Getting Started</h3>
<p>We&#8217;ll need Tween Effects to use them in our player. <a href="http://www.greensock.com/tweenmax/">Click here to download TweenMax.</a><br />
I&#8217;ll make the all ActionScript explanations in the code areas. All you need is following the tutorial carefully. I&#8217;m sure that even if you don&#8217;t know ActionScript, you&#8217;ll be able to create this player. Let&#8217;s start to create it!</p>
<h3>Step 1 &#8211; Preparing The Folders</h3>
<p>We must create a main folder to collect all folders and files. Create a new folder and apply the steps like the following:</p>
<p>1.Move &#8220;com&#8221; folder (from TweenMax) into the main folder.</p>
<p>2.Create a new folder called &#8220;musics&#8221;. Move your own songs into the this folder.</p>
<p>3.Create a ActionScript 3.0 Flash Project and XML Project (by using Dreamweaver or Notepad).</p>
<p>4.Save as them.</p>
<p>You should have had a folder like this:</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/16.jpg"><img class="alignnone size-full wp-image-320" title="1" src="http://tuts.flashmint.com/wp-content/uploads/16.jpg" alt="" width="375" height="127" /></a></p>
</div>
<h3>Step 2 &#8211; Properties of The Canvas</h3>
<p>Open the project you saved. Every element of the design can be changed. I used sample values. Your stage size must be about 300&#215;200. Background Color (#191611 )</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/23.jpg"><img class="alignnone size-full wp-image-321" title="2" src="http://tuts.flashmint.com/wp-content/uploads/23.jpg" alt="" width="273" height="343" /></a></p>
</div>
<h3>Step 3 &#8211; Creating The Background Of MusicBox</h3>
<p>We&#8217;ll use a rectangle and square for background of MusicBox. Outline Color (#3E362D), Main Color (#2F2922). Fill the shapes like the following.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/33.jpg"><img class="alignnone size-full wp-image-322" title="3" src="http://tuts.flashmint.com/wp-content/uploads/33.jpg" alt="" width="337" height="233" /></a></p>
<h3>Step 4 &#8211; Importing Cover Image</h3>
<p>Import (Ctrl + R) your cover image to the stage and embed it. Cover image must be small than cover background (95&#215;95).</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/43.jpg"><img class="alignnone size-full wp-image-323" title="4" src="http://tuts.flashmint.com/wp-content/uploads/43.jpg" alt="" width="332" height="228" /></a></p>
</div>
<h3>Step 5 &#8211; Creating Gradient</h3>
<p>Create a new rectangle and crop it like the following. Reduce its alpha value to 10. You can use every color for making this effect.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/54.jpg"><img class="alignnone size-full wp-image-324" title="5" src="http://tuts.flashmint.com/wp-content/uploads/54.jpg" alt="" width="344" height="247" /></a></p>
</div>
<h3>Step 6 &#8211; Creating Player Elements</h3>
<p>If you have any player icon set or like this, of course you can use it in your project. I used &#8220;Webdings&#8221; font set. We have 5 elements in the player. Now, we&#8217;ll give them their instance names. Pause Button: &#8220;PauseBtn&#8221;, Play Button: &#8220;PlayBtn&#8221;, Next Button &#8220;NextBtn&#8221;, Previous Button: &#8220;PrevBtn&#8221; and finally Mute Button &#8220;MuteBtn&#8221;.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/63.jpg"><img class="alignnone size-full wp-image-325" title="6" src="http://tuts.flashmint.com/wp-content/uploads/63.jpg" alt="" width="338" height="237" /></a></p>
</div>
<h3>Step 7 &#8211; The Name of The Song</h3>
<p>Create a dynamic text on your main scene. Set its properties like the following.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/73.jpg"><img class="alignnone size-full wp-image-326" title="7" src="http://tuts.flashmint.com/wp-content/uploads/73.jpg" alt="" width="600" height="411" /></a></p>
</div>
<h3>Step 8 &#8211; Preview of The Design</h3>
<p>We have just finished the design of the MusicBox. I&#8217;ll make the MusicBox &#8220;drag&amp;drop&#8221;. So, it can be moved each folder easily. Also, I&#8217;ll add a drop shadow effect ( Blur X-Y: 8, Quality: High, Distance: 0 ) to my design. Select all items and covert them to the MovieClip.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/81.jpg"><img class="alignnone size-full wp-image-327" title="8" src="http://tuts.flashmint.com/wp-content/uploads/81.jpg" alt="" width="507" height="388" /></a></p>
</div>
<h3>Step 9 &#8211; Coding The Design</h3>
<p>Now, we&#8217;ll write the codes of the design. I&#8217;ll use XML File for calling songs and titles. I want to start with defining the elements and variables of the player. Open MovieClip and write the following codes:</p>
<pre>///Defining The Elements and Variables of the Music Player</pre>
<pre>var MusicLoading:URLRequest;//File Request</pre>
<pre>var music:Sound = new Sound();</pre>
<pre>var sc:SoundChannel;</pre>
<pre>var currentSound:Sound=music;</pre>
<pre>var CurrentPos:Number;//Current Position of the Song</pre>
<pre>var xml:XML;</pre>
<pre>var songlist:XMLList;//Music List from XML</pre>
<pre>var currentIndex:Number=0;//The Number of Index</pre>
<pre>var MuteFunc:SoundTransform = new SoundTransform();//Mute Functions</pre>
<pre>var XMLLoader:URLLoader = new URLLoader();//XML Loader</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 10 &#8211; Coding The Design</span></h3>
<p>We&#8217;re going on with XML Actions.</p>
<pre>//If XML File Load successfully, it will be voided this actions:</pre>
<pre>XMLLoader.addEventListener(Event.COMPLETE, success);</pre>
<pre>function success(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>xml=new XML(e.target.data);</pre>
<pre><span style="mso-tab-count: 1;">        </span>songlist=xml.song;//For adding a new song in XML File.</pre>
<pre><span style="mso-tab-count: 1;">        </span>MusicLoading=new URLRequest(songlist[0].file);</pre>
<pre><span style="mso-tab-count: 1;">        </span>music.load(MusicLoading);</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc=music.play();</pre>
<pre><span style="mso-tab-count: 1;">        </span>MusicName.text=songlist[0].name;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.addEventListener(Event.SOUND_COMPLETE, nextSong);</pre>
<pre>}</pre>
<pre>//The Name of the XML File.</pre>
<pre>XMLLoader.load(new URLRequest("playlist.xml"));</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 11 &#8211; Coding The Design</span></h3>
<p>Adding Event Listeners for the control buttons.</p>
<pre>//Add Event Listeners for control buttons</pre>
<pre>PauseBtn.addEventListener(MouseEvent.CLICK,pauseSong);</pre>
<pre>PlayBtn.addEventListener(MouseEvent.CLICK,playSong);</pre>
<pre>NextBtn.addEventListener(MouseEvent.CLICK, nextSong);</pre>
<pre>PrevBtn.addEventListener(MouseEvent.CLICK, prevSong);</pre>
<pre>MuteBtn.addEventListener(MouseEvent.CLICK, Mute);</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 12 &#8211; Coding The Design</span></h3>
<p>Next Song Functions.</p>
<pre>//Next Song Functions</pre>
<pre>function nextSong(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>if (currentIndex &lt; (songlist.length() +1)) {//Next Song(+1)</pre>
<pre><span style="mso-tab-count: 2;">               </span>currentIndex++;</pre>
<pre><span style="mso-tab-count: 1;">        </span>} else {</pre>
<pre><span style="mso-tab-count: 2;">               </span>currentIndex=0;</pre>
<pre><span style="mso-tab-count: 1;">        </span>}</pre>
<pre><span style="mso-tab-count: 1;">        </span>//New Request for Next Song</pre>
<pre><span style="mso-tab-count: 1;">        </span>var nextSongFunc:URLRequest=new URLRequest(songlist[currentIndex].file);</pre>
<pre><span style="mso-tab-count: 1;">        </span>var nextTitle:Sound=new Sound(nextSongFunc);</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.stop();</pre>
<pre><span style="mso-tab-count: 1;">        </span>MusicName.text=songlist[currentIndex].name;//Writing New Song's name</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc=nextTitle.play();</pre>
<pre><span style="mso-tab-count: 1;">        </span>currentSound=nextTitle;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.addEventListener(Event.SOUND_COMPLETE, nextSong);</pre>
<pre>}</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 13 &#8211; Coding The Design</span></h3>
<p>Prev Song Functions.</p>
<pre>//Prev Song Functions</pre>
<pre>function prevSong(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>if (currentIndex&gt;0) {</pre>
<pre><span style="mso-tab-count: 2;">               </span>currentIndex--;</pre>
<pre><span style="mso-tab-count: 1;">        </span>} else {</pre>
<pre><span style="mso-tab-count: 2;">               </span>currentIndex=songlist.length()-1;//Prev Song(-1)</pre>
<pre><span style="mso-tab-count: 1;">        </span>}</pre>
<pre><span style="mso-tab-count: 1;">        </span>var prevSongFunc:URLRequest=new URLRequest(songlist[currentIndex].file);</pre>
<pre><span style="mso-tab-count: 1;">        </span>var prevTitle:Sound=new Sound(prevSongFunc);</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.stop();</pre>
<pre><span style="mso-tab-count: 1;">        </span>MusicName.text=songlist[currentIndex].name;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc=prevTitle.play();//Writing Prev Song's name</pre>
<pre><span style="mso-tab-count: 1;">        </span>currentSound=prevTitle;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.addEventListener(Event.SOUND_COMPLETE, nextSong);</pre>
<pre>}</pre>
<h3>Step 14 &#8211; Coding The Design</h3>
<p>Pause and Play Functions.</p>
<pre>//Pause The Song (sc.stop)</pre>
<pre>function pauseSong(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>CurrentPos=sc.position;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.stop();</pre>
<pre>}</pre>
<pre>//Play The Song</pre>
<pre>function playSong(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc=currentSound.play(CurrentPos);</pre>
<pre>}</pre>
<h3>Step 15 &#8211; Coding The Design</h3>
<p>Mute Button Functions. Here, We must create a new dynamic text to show status of the mute button. Open &#8220;MuteButton&#8221; and create a dynamic text. Give it a instance name called &#8220;mute&#8221;.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/91.jpg"><img class="alignnone size-full wp-image-328" title="9" src="http://tuts.flashmint.com/wp-content/uploads/91.jpg" alt="" width="320" height="224" /></a></p>
</div>
<pre>MuteBtn.mute.text="VOLUME ON"; //First Text</pre>
<pre>//We'll use Sound Transform Actions For "Mute" and "Unmute"</pre>
<pre>function Mute(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteFunc.volume=0;//Close the volume of the music.</pre>
<pre><span style="mso-tab-count: 1;">        </span>SoundMixer.soundTransform=MuteFunc;</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.mute.text=String("VOLUME OFF");//When clicked to the "MUTE BUTTON"</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.mute.alpha=0.9;</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.addEventListener(MouseEvent.CLICK, UnMute);</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.removeEventListener(MouseEvent.CLICK, Mute);</pre>
<pre>}</pre>
<pre>//UnMute</pre>
<pre>function UnMute(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteFunc.volume=1;//Open The volume of the music.</pre>
<pre><span style="mso-tab-count: 1;">        </span>SoundMixer.soundTransform=MuteFunc;</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.mute.text=String("VOLUME ON");//When clicked to the "MUTE BUTTON" again"</pre>
<pre><span style="mso-tab-count: 1;">        </span>MuteBtn.addEventListener(MouseEvent.CLICK, Mute);</pre>
<pre>}</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 16 &#8211; Effects on the Buttons</span></h3>
<p>Finally, I want to add some effects to the control buttons. Now, We need TweenMax. So, Type these codes to the each button&#8217;s first frame.</p>
<pre>//Import Tweens</pre>
<pre>import com.greensock.*;</pre>
<pre>import com.greensock.easing.*;</pre>
<pre>//Mouse Over &amp; Out Functions</pre>
<pre>this.addEventListener(MouseEvent.MOUSE_OVER, MouseOverFunc);</pre>
<pre>this.addEventListener(MouseEvent.MOUSE_OUT, MouseOutFunc);</pre>
<pre>//Mouse Over Function</pre>
<pre>function MouseOverFunc(e:Event):void {</pre>
<pre>//Glow Effect</pre>
<pre><span style="mso-tab-count: 1;">        </span>TweenMax.to(this, 0.5, {glowFilter:{color:0xb0a295, alpha:1, blurX:4, blurY:4}});</pre>
<pre>}</pre>
<pre>//Mouse Out Function</pre>
<pre>function MouseOutFunc(e:Event):void {</pre>
<pre><span style="mso-tab-count: 1;">        </span>//Without Glow Effect</pre>
<pre><span style="mso-tab-count: 1;">        </span>TweenMax.to(this, 0.5, {glowFilter:{color:0xb0a295, alpha:0, blurX:4, blurY:4}});</pre>
<pre>}</pre>
<h3><span style="mso-fareast-font-family: &amp;amp;amp;">Step 17 – Right Click Menu</span></h3>
<p>Finally, We&#8217;ll add Right Click Menu to the MusicBox. When you click to the MusicPlayer, you&#8217;ll see a context menu with Pause Song Function.</p>
<pre>//Right Click Menu Actions</pre>
<pre>var RightClickMenu:ContextMenu = new ContextMenu();//New Menu</pre>
<pre>RightClickMenu.hideBuiltInItems();//Zoom, Select ets. are hidden.</pre>
<pre>var menuItem1:ContextMenuItem=new ContextMenuItem("© 2010 - AS3 MusicBox");//The Name of The First Item</pre>
<pre>var menuItem2:ContextMenuItem=new ContextMenuItem("Pause The Song");//The Name of The Second Item</pre>
<pre>menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, pauseSongFunc);//Pause Song Event Listener</pre>
<pre>RightClickMenu.customItems.push(menuItem1);</pre>
<pre>RightClickMenu.customItems.push(menuItem2);</pre>
<pre>this.contextMenu=RightClickMenu;</pre>
<pre>function pauseSongFunc(e:ContextMenuEvent):void { //Same actions with "Pause Song"</pre>
<pre><span style="mso-tab-count: 1;">        </span>CurrentPos=sc.position;</pre>
<pre><span style="mso-tab-count: 1;">        </span>sc.stop();</pre>
<pre>}</pre>
<h3>Step 18 &#8211; Creating XML File</h3>
<p>Open your XML File. Write these codes. &#8220;Name&#8221; is the title of the song. &#8220;File&#8221; is the path of the song with file format.</p>
<div>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/101.jpg"><img class="alignnone size-full wp-image-319" title="10" src="http://tuts.flashmint.com/wp-content/uploads/101.jpg" alt="" width="360" height="393" /></a></p>
</div>
<h3>Final Step &#8211; Conclusion</h3>
<p>Congratulations. You&#8217;re done! Test your movie and listen to the musics. You&#8217;ve created a MusicPlayer with ActionScript 3 and XML. The possibilities are endless. You can provide and use this project. If you have any question, please leave a reply here. I hope you enjoyed this tutorial and thanks for reading.</p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/flash-mp3-music-player-tutorial/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/flash-mp3-music-player-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Create A Simple Image Gallery In Flash CS4</title>
		<link>http://tuts.flashmint.com/how-to-create-a-simple-image-gallery-in-flash-cs4/</link>
		<comments>http://tuts.flashmint.com/how-to-create-a-simple-image-gallery-in-flash-cs4/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 13:04:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[flash components]]></category>
		<category><![CDATA[flash gallery]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=130</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<table width="100%" border="0" cellspacing="10 cellpadding="0">
<tr>
<td>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagegallery3_1771525899"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/imagegallery3.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/imagegallery3.swf"
			name="fm_imagegallery3_1771525899"
			width="400"
			height="300">
	<!--<![endif]-->
		<br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></td>
<td valign="top">In this tutorial we will show you how to create a <strong>simple image gallery with thumbnails in Flash CS4</strong>. We will apply a couple of simple, yet nice transitions to the images and thumbnails. This will require you to get the hands a bit dirty in animation and action scripting. However, this is going to be easy and fun! So here we go.</td>
</tr>
</table>
<p><span id="more-130"></span><br />
<h3>Step 1.</h3>
<p>Create a new file with ActionScript 3.0 and modify the document like it&#8217;s shown on the screenshot below. You can enter the document properties via the admin panel (follow the highlights in red) or pressing <strong>Ctrl+J</strong>.</p>
<p style="text-align: center;"><img class="size-full wp-image-131 aligncenter" title="1c" src="http://tuts.flashmint.com/wp-content/uploads/1c.jpg" alt="1c" width="600" height="326" /></p>
<h3>Step 2.</h3>
<p>Add four images from your computer to your library. To do this press <strong>File =&gt; Imort =&gt; Import to library</strong>. You can also import the images directly to the stage, by pressing <strong>Ctrl+R</strong>.</p>
<p>Next, create three new layers and give them the names <strong>Buttons</strong>,<strong> Images</strong> and <strong>Actions</strong>. To rename a layer, double click on it and type the text.  See the shot below.</p>
<p style="text-align: center;"><img class="size-full wp-image-132 aligncenter" title="2c" src="http://tuts.flashmint.com/wp-content/uploads/2c.jpg" alt="2c" width="600" height="372" /></p>
<p>Notice that the first frame of each layer has a small circle on it. This is a <em>blank keyframe</em>. Once you put anything on the stage, the circle transforms into black dot which corresponds to the <em>filled keyframe</em>.</p>
<p>Go to the Buttons layer and select the first frame on the timeline. <strong>Drag the images from your library to the stage</strong> (in case you haven&#8217;t imported them right to the stage already) and modify their size to <strong>114&#215;85 px</strong>. Be sure to drag the images to our document area which we&#8217;ve made black earlier.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/3c.jpg"><img class="size-full wp-image-133 aligncenter" title="3c" src="http://tuts.flashmint.com/wp-content/uploads/3c.jpg" alt="3c" width="600" height="289" /></a></p>
<p>Now you have your thumbnails on the stage. Set image alignment selecting <strong>Align</strong> in <strong>Window menu</strong>, or just press <strong>Ctrl+K</strong>. Align pics to the bottom and distribute horizontal center like it&#8217;s shown below.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/4c.jpg"><img class="size-full wp-image-134 aligncenter" title="4c" src="http://tuts.flashmint.com/wp-content/uploads/4c.jpg" alt="4c" width="600" height="328" /></a></p>
<h3>Step 3.</h3>
<p>Our thumbnails are going to be buttons, so now we need to convert the images into the Button symbols. Using the<strong> Selection Tool</strong>, right click on the first thumbnail image and choose <strong>&#8220;Convert to Symbol&#8221;</strong>, or simply hit <strong>F8</strong>. In the opened window set the type Button and name the symbol <strong>btn1</strong>. Click &#8220;OK&#8221; to save the changes. Do this for the other three images and give them the names <strong>btn2</strong>, <strong>btn3</strong> and <strong>btn4</strong>, respectively.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/5c.jpg"><img class="size-full wp-image-135 aligncenter" title="5c" src="http://tuts.flashmint.com/wp-content/uploads/5c.jpg" alt="5c" width="600" height="425" /></a></p>
<p>Now we have to give each of these the same <em>Instance Name</em> which is a name to refer to your symbol or object in ActionScript. Instance Name can be set in the Properties panel which you can enter by selecting the necessary object on the stage. Instance Name of the <strong>btn1</strong> button will be <strong>btn1</strong> and so forth.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/6c.jpg"><img class="size-full wp-image-136 aligncenter" title="6c" src="http://tuts.flashmint.com/wp-content/uploads/6c.jpg" alt="6c" width="300" height="155" /></a></p>
<p>Right click on the first frame of the Buttons layer, select <strong>Copy Frames</strong>, go to the fourth frame and <strong>Paste Frames</strong> the same way. Or you can just drag the first frame up to the fourth cell to copy it. You timeline should have the following look by now.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/7c.jpg"><img class="size-full wp-image-137 aligncenter" title="7c" src="http://tuts.flashmint.com/wp-content/uploads/7c.jpg" alt="7c" width="600" height="392" /></a></p>
<h3>Step 4.</h3>
<p>OK, let&#8217;s put the images that we will be exactly viewing in our gallery. Switch to the <strong>Images layer</strong> and select the first frame on the timeline. Drag the image that corresponds to the first thumbnail from your library to the stage. Size it down to the <strong>358&#215;268 px</strong> and set its position to the <strong>93&#215;18</strong>. Of course, you may set your own dimensions and place the pictures whatever you like; this is just what we use for this tutorial.</p>
<p>Insert three more blank keyframes (<strong>F6</strong>) and do the same operation with the rest of the images.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/8c.jpg"><img class="size-full wp-image-138 aligncenter" title="8c" src="http://tuts.flashmint.com/wp-content/uploads/8c.jpg" alt="8c" width="600" height="363" /></a></p>
<p>Now go back to the timeline, select the first frame and go to the Properties panel. Here we will set the <em>Frame Label</em>. It&#8217;s important to remember about this because we&#8217;re going to reference frame labels in the ActionScript later. We&#8217;ve got four frame labels: <strong>model</strong>, <strong>dreamy</strong>, <strong>dancing </strong>and<strong> teacher</strong>, respectively.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/9c.jpg"><img class="size-full wp-image-139 aligncenter" title="9c" src="http://tuts.flashmint.com/wp-content/uploads/9c.jpg" alt="9c" width="600" height="360" /></a></p>
<h3>Step 5.</h3>
<p>So far we&#8217;ve got a thumbnail gallery where each of the thumbs is a button. Our next step is to <strong>add some action script</strong> so we could click on the button to play the right frame. Go to the <strong>Actions layer</strong> and drag the first frame up to the fourth cell. Your timeline should have the following look by this moment:</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/10c.jpg"><img class="size-full wp-image-140 aligncenter" title="10c" src="http://tuts.flashmint.com/wp-content/uploads/10c.jpg" alt="10c" width="300" height="258" /></a></p>
<p>Go back to the first frame in the Actions layer and hit <strong>F9</strong> to open the <strong>Actions window</strong>. Copy and paste the following code into your Actions window. Don&#8217;t worry, we will explain in great detail what happens shortly.<br />
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw7">stop</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
btn1<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span>play1<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw3">function</span> play1<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
<span class="kw7">gotoAndStop</span> <span class="br0">&#40;</span><span class="st0">&quot;young&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
btn2<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span>play2<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw3">function</span> play2<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
<span class="kw7">gotoAndStop</span> <span class="br0">&#40;</span><span class="st0">&quot;thoughtful&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
btn3<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span>play3<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw3">function</span> play3<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
<span class="kw7">gotoAndStop</span> <span class="br0">&#40;</span><span class="st0">&quot;dancing&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
btn4<span class="sy0">.</span><span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span>play4<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw3">function</span> play4<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
<span class="kw7">gotoAndStop</span> <span class="br0">&#40;</span><span class="st0">&quot;old&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span></pre></div></div><br />
After you have copied and pasted the above code, go to <strong>Control =&gt; Test Movie</strong> or press <strong>Ctrl + Enter</strong> to see the result gallery. Here is what you should get:</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagegallery_1530652373"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/imagegallery.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/imagegallery.swf"
			name="fm_imagegallery_1530652373"
			width="400"
			height="300">
	<!--<![endif]-->
		  
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Let&#8217;s look closer at what you&#8217;ve just done and learn more about AS functions.  The first thing you see in your code window is Stop action.</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw7">stop</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>Any effect you create in Flash repeats continuously when you test or publish your movie. Stop action is used to actually stop it from looping. You can apply the Stop action to any keyframe and the movie will stop playing at that exact point.</p>
<p>The next code line is</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;">btn1<span class="sy0">.</span> <span class="kw7">addEventListener</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="sy0">.</span><span class="kw8">CLICK</span><span class="sy0">,</span>play1<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>This script means that <strong>btn1</strong>, our instance name, referring to the first button in our thumbnail gallery, is responding to a mouse click and calls for the function <strong>play1</strong>.</p>
<p>And here goes the definition of that function</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://tuts.flashmint.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw3">function</span> play1<span class="br0">&#40;</span>event<span class="sy0">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span class="kw5">MouseEvent</span></a><span class="br0">&#41;</span><span class="sy0">:</span><span class="kw1">void</span><span class="br0">&#123;</span>
<span class="kw7">gotoAndStop</span><span class="br0">&#40;</span><span class="st0">&quot;model&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>In this line:</p>
<ul>
<li><em><strong>function play1</strong></em> tells us the name of the function;</li>
<li><em><strong>(event:MouseEvent)</strong></em> defines the type of the event , which is interaction with the mouse here,</li>
<li> <em><strong>void</strong></em> is a special type used to specify that the function doesn&#8217;t return any data;</li>
<li> <em><strong>gotoAndStop (&#8220;model&#8221;)</strong></em> causes the playhead to jump to the frame model and stops from progressing further.</li>
</ul>
<p>All right, this is the initial script that allows our image gallery to work properly. As you see, this piece of code repeats for the rest of the buttons, we <strong>change only instance names and frame labels</strong>.</p>
<h3>Step 6.</h3>
<p>To add some spice to our images when they come in, let&#8217;s learn how to animate them in Flash CS4.</p>
<p>So, go up to your <strong>Images layer</strong> and select the first frame. To be able to add some animation to our images, we need to convert them to movie clip symbols. To do this hit <strong>F8</strong> and select <strong>Movie Clip</strong> in the Type menu. Repeat this operation for each of the four images. Let the names be <strong>movie1</strong>, <strong>movie2</strong>, <strong>movie3</strong> and <strong>movie4</strong>.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/11c.jpg"><img class="size-full wp-image-141 aligncenter" title="11c" src="http://tuts.flashmint.com/wp-content/uploads/11c.jpg" alt="11c" width="600" height="450" /></a></p>
<p>Choose the Selection tool from your toolbar and <strong>double click on the first movie clip</strong> we&#8217;ve just created. Now we can animate it.</p>
<p>Right click on the movie clip on the stage and select <strong>Create Motion Tween</strong>.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/12c.jpg"><img class="size-full wp-image-142 aligncenter" title="12c" src="http://tuts.flashmint.com/wp-content/uploads/12c.jpg" alt="12c" width="600" height="331" /></a></p>
<p>You can see that it automatically inserts some frames; the number of frames inserted depends on your frame rate. By default Flash CS4 has a frame rate of 24 frames per second. So basically you have the number of frames that would equal one second. Let&#8217;s <strong>cut it down to 15 frames per second</strong> &#8211; just drag the border of the 24th frame down to the one we need.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/13c.jpg"><img class="size-full wp-image-143 aligncenter" title="13c" src="http://tuts.flashmint.com/wp-content/uploads/13c.jpg" alt="13c" width="600" height="146" /></a></p>
<p>Now<strong> let&#8217;s create a sleek fade-in effect</strong> by means of some color effects and motion tween. Select the image on the stage while the playhead is on the last frame. Go to the object properties, choose <strong>Alpha</strong> in the <strong>Style menu</strong> and put it 0%.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/14c.jpg"><img class="size-full wp-image-144 aligncenter" title="14c" src="http://tuts.flashmint.com/wp-content/uploads/14c.jpg" alt="14c" width="600" height="336" /></a></p>
<p>Move the playhead back and forth and you will see that <strong>we&#8217;ve created a fade-out effect</strong> for our image &#8211; it&#8217;s completely transparent on the last keyframe. Right click anywhere on the motion tween area and select <strong>Reverse Keyframes</strong>. Now we have the fade-in effect applied to the picture.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/15c.jpg"><img class="size-full wp-image-145 aligncenter" title="15c" src="http://tuts.flashmint.com/wp-content/uploads/15c.jpg" alt="15c" width="600" height="246" /></a></p>
<p>Click <strong>Ctrl+Enter</strong> to test your movie. You should see something like this:</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagegallery11_645290979"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/imagegallery11.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/imagegallery11.swf"
			name="fm_imagegallery11_645290979"
			width="400"
			height="300">
	<!--<![endif]-->
		
<p style="text-align: center;">
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Movie plays over and over again and we don&#8217;t want this loop happen. Stop action comes in handy here. Return to your movie clip window, right click on the motion tween area and select <strong>Convert to Frame by Frame Animation</strong>. Then go to the last frame and hit <strong>F9</strong>. Type <strong><em>stop()</em></strong> in the Actions window and that should fix the problem.</p>
<p>Here is the result:</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagegallery21_729503952"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/imagegallery21.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/imagegallery21.swf"
			name="fm_imagegallery21_729503952"
			width="400"
			height="300">
	<!--<![endif]-->
		
<p style="text-align: center;">
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h3>Step 7.</h3>
<p>Another cute effect we&#8217;re going to apply is <strong>rollover</strong>. Wouldn&#8217;t it be nice to have the thumbnails change a bit when the mouse hovers over? And that&#8217;s pretty easy to do, here we go!</p>
<p>Double click on the first button in the thumbnail line, which is <strong>btn1</strong>. You can see four frames on your timeline &#8211; <strong>Up</strong>, <strong>Over</strong>, <strong>Down</strong> and <strong>Hit</strong>. These are the states of our button.</p>
<ul>
<li>The <strong><em>Up</em></strong> frame is the inactive stage when nothing is happening, the button is displayed as it is.</li>
<li>The <strong><em>Over</em></strong> is the stage when the mouse hovers over the button.</li>
<li>The <strong><em>Down</em></strong> frame is the stage when the button is clicked on.</li>
<li>The purpose of the <em><strong>Hit</strong></em> frame is to define the clickable area or the coordinates of the button.</li>
</ul>
<p>So, insert blank keyframes (<strong>F6</strong>) into each of the frames.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/16c.jpg"><img class="size-full wp-image-146 aligncenter" title="16c" src="http://tuts.flashmint.com/wp-content/uploads/16c.jpg" alt="16c" width="600" height="323" /></a></p>
<p>Go to the Over and select the button on the stage. In order to modify the way it is rendered, we need to convert it into a graphic symbol. Press <strong>F8</strong> and select <strong>Graphic</strong> in the Type menu. Now go to the object properties and do some changes to the color effect. You may do whatever you want, we changed the RGB parameters, for example (see the screenshot below).</p>
<p>Switch to the Down frame and apply some effects if you want the button to change its state when you click on it. In this case, we&#8217;ve added more red to it.</p>
<p>Move on to the Hit area and using the <strong>Rectangular Tool</strong> draw an area you want to be clickable on your button.</p>
<p style="text-align: center;"><a href="http://tuts.flashmint.com/wp-content/uploads/17c.jpg"><img class="size-full wp-image-147 aligncenter" title="17c" src="http://tuts.flashmint.com/wp-content/uploads/17c.jpg" alt="17c" width="600" height="346" /></a></p>
<p>Repeat this step for the other three buttons and press <strong>Ctrl+Enter</strong> to see the result. It should be similar to this:</p>
<p style="text-align: center;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_imagegallery3_1078561192"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="http://tuts.flashmint.com/wp-content/uploads/imagegallery3.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tuts.flashmint.com/wp-content/uploads/imagegallery3.swf"
			name="fm_imagegallery3_1078561192"
			width="400"
			height="300">
	<!--<![endif]-->
		
<p style="text-align: center;">
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>This is it, folks. Now you know how to create a simple image gallery with thumbnails and spice it with some nice effects. If you have any questions, please leave them in comments.</p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/how-to-create-a-simple-image-gallery-in-flash-cs4/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/how-to-create-a-simple-image-gallery-in-flash-cs4/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Creating Flash Menu Tutorial</title>
		<link>http://tuts.flashmint.com/creating-flash-menu-tutorial/</link>
		<comments>http://tuts.flashmint.com/creating-flash-menu-tutorial/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 14:37:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[flash menu]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=108</guid>
		<description><![CDATA[Though website design is a prerogative of professionals, still there is a lot that anyone could do only if he knew how to. Making a menu for a flash website is one of these things. To make one you need to have a tool and to know the procedure. Your tool is Photoshop (mine is [...]]]></description>
			<content:encoded><![CDATA[<p>Though website design is a prerogative of professionals, still there is a lot that anyone could do only if he knew how to. Making a menu for a flash website is one of these things. To make one you need to have a tool and to know the procedure. Your tool is Photoshop (mine is CS3 version), and the procedure is described in every detail in the tutorial below. I tried to make it simple, so that even it is your first time using Photoshop, you don&#8217;t get startled. Each step has screenshots to make it even more clear. Just keep in mind, that if you have a different Photoshop version, the interface might differ slightly.</p>
<p>If you follow each of the listed steps carefully, as a result you will get a flash menu like this:</p>
<p><img class="alignnone" src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_100f3t39nf6_b.jpg" alt="" width="870" height="232" /></p>
<p><span id="more-108"></span></p>
<p><strong><span style="text-decoration: underline;">Step 1</span>: <em>creating a shape</em><br />
</strong><br />
Open your Photoshop and create a new document <strong>(Ctrl+N)</strong> with size 600&#215;300 pixels. Set a color for the background: black gives a good contrast, so you can use it unless your menu color is going to be black.<br />
Create a new layer <strong>(Ctrl+Shift+N)</strong> and select a<strong> Rounded Rectangle Tool </strong><strong>(U)</strong><strong>.</strong></p>
<p>In Rounded Rectangle Tool settings activate <strong>Shape Layers</strong> button and set <strong>Radius:8px</strong>.<br />
You can set a different radius value according to your taste, just take some time to experiment.</p>
<p>After you are done with Tool settings, draw a rectangle shape of the needed size (mine is 120x45px). Set the color. Mine is <strong>color:#25b6b1</strong>. To change the color click twice on the layer of your rectangle shape and pick the color you need from palette.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_101hqd3w9dx_b.jpg" alt="" /></p>
<p><strong><span style="text-decoration: underline;">Step 2</span>: <em>adding gradient</em> </strong><br />
Select   <strong>Layer</strong> &gt; <strong>Layer Style </strong>&gt; <strong>Blending Option</strong><em>s</em> and set all the values like shown on the screenshot.  Select <strong>Gradient Overlay</strong> and place a tick in the box next to it.</p>
<p>To change the color click twice on the <strong>Gradient </strong>palette and you&#8217;ll see a color changing tool with four sliders (two on the top and two on the bottom). To set the color for each of the sliders you need to click twice on it. For two sliders on the bottom set <strong>Color:#00fff6. </strong></p>
<p>The sliders on the top change <strong>Opacity</strong> value. Make the right slider active and set <strong>Opacity:0.</strong></p>
<p><strong> </strong></p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_103c7q4zjd9_b.jpg" alt="" /></p>
<p>When you are done with this, press <strong>OK</strong> and your button will look somewhat like this</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_105c7fq9rc7_b.jpg" alt="" /></p>
<p><strong><span style="text-decoration: underline;">Step 3</span>:<em> inner shadow</em> </strong><br />
Go to<strong> Layer </strong>&gt; <strong>Layer Style </strong>&gt; <strong>Blending Options</strong> and select<strong> Stroke</strong>. Set <strong>Size:1px</strong>, <strong>Position:Outside</strong>, <strong>Color:#02fbf2.</strong><br />
Then select <strong>Inner Shadow</strong> and set the <strong>Color:#003e39</strong>, <strong>Opacity:84%</strong>,<strong> Size:9px</strong>.</p>
<p>The result will look like:</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_107f5vc3rc7_b.jpg" alt="" /></p>
<p><strong><span style="text-decoration: underline;">Step 4</span>: <em>brush</em></strong><br />
Create a new layer <strong>(Ctrl+Shift+N)</strong> and select a <strong>Brush Tool (B)</strong>. Use a standard Airbrush. Set <strong>Color:#006965</strong>, <strong>Diameter:200px.</strong><strong><br />
</strong></p>
<ul>
<li>Click 2 or 3 times on the top of your button. The more times you click the more intense shadow you will get, so you need to watch for the best result.</li>
<li>Then do a <strong>Ctrl+click</strong> on your button layer in the <strong>Layers</strong> panel at the right side of your screen to highlight this layer.</li>
<li>After this you need to <strong>invert</strong> the highlighting by clicking <strong>Ctrl+Shift+</strong><strong>I. </strong>Now press <strong>Delete. </strong></li>
</ul>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_109g6n7gbgt_b.jpg" alt="" /></p>
<p><strong><span style="text-decoration: underline;">Step 5</span>: <em>transparency</em></strong><br />
Create a new layer <strong>(Ctrl+Shift+N)</strong>. Select a  <strong>Rounded Rectangle Tool </strong><strong>(U) </strong>with the same settings as the previous time. Draw a rectangle object (approximate <strong>Size: 115x25px</strong>, <strong>Color:#79fffa</strong>).<br />
Then click <strong>Add Layer Mask</strong> on your <strong>Layers</strong> panel.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_110ccmxrxw2_b.jpg" alt="" /></p>
<p>Add <strong>Transparency</strong> to the layer using <strong>Gradient Tool (G)</strong>. Hold <strong>Shift</strong> and draw a vertical line of the gradient from the bottom the the top ( gradient <strong>Color: back+white</strong>). <strong></strong></p>
<p><strong> </strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_111r24gw89_b.jpg" alt="" /></strong></p>
<p><strong><span style="text-decoration: underline;">Step 6</span>: <em>reflection</em></strong><br />
Select the layers with<strong> Shift </strong>button and put them into a folder (<strong>Ctrl+G</strong>) <strong></strong></p>
<p><strong> </strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_112dnd44c4_b.jpg" alt="" /></strong></p>
<p>Then duplicate this Group by clicking with the right button if your mouse on it and selecting Duplicate Group.<br />
Then you need to <strong>unite</strong> all the layers into one layer. To do this you need to highlight this folder and press <strong>Ctrl+E.</strong><strong></strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_113f69knsd8_b.jpg" alt="" /></strong></p>
<p><strong> </strong></p>
<p>To look better the button needs to have a reflection. To make a reflection you need to <strong>rotate</strong> your duplicate layer (<strong>Ctrl+T</strong>). Do a right-click on the object and select <strong>Rotate 180&#8242; </strong><strong></strong></p>
<p><strong> </strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_114cx869qfn_b.jpg" alt="" /><br />
</strong><br />
Place the layer like shown on the screenshot.<br />
And, like before, <strong>Add layer mask</strong> and use the <strong>Gradient Tool</strong> (<strong>Color:transparent and black</strong>). Make your shadow look somewhat like on the screenshot by playing around with opacity. <strong></strong></p>
<p><strong> </strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_115cksw43c9_b.jpg" alt="" /></strong></p>
<p><strong><span style="text-decoration: underline;">Step 7</span>: <em>text</em></strong><br />
Your button is ready, all you need to do is place a text of its <strong>name</strong>. Select <strong>Horizontal Type tool (T),</strong> click on the place where the text must be and type in your button name. Press <strong>Ctrl+Enter.</strong></p>
<p><strong> </strong></p>
<p>You can also add a shadow effect to the text by following <strong>Layer </strong>&gt; <strong>Layer Style </strong>&gt; <strong>Blending Options </strong>and select <strong>Drop Shadow</strong>. Set parameters about <strong>Opacity:33%</strong>, <strong>Size:5px</strong>, <strong>Color:#019b95.</strong></p>
<p><strong> </strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_116fs8w92gp_b.jpg" alt="" /><br />
</strong><br />
To finish your flash menu you need to make copies of your button and place them next to each other. It&#8217;s done!</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dgm4gh6p_117jfdz2td3_b.jpg" alt="" /><br />
<strong><span style="text-decoration: underline;">Step 8</span>: <em>cutting parts for Flash animation</em></strong></p>
<p><strong> </strong></p>
<p>Recreating this neat menu in Flash will require 2 elements of the button: <strong>the button itself</strong> and <strong>the shadow</strong>. Let&#8217;s crop &amp; save them.</p>
<p>In the <strong>Layers</strong> section hide all button groups and leave only one button. Hide its shadow and its text. Then use the <strong>Crop Tool</strong> to crop the button. My crop size was about 132*49. And don&#8217;t forget to hide the black background layer. Save the resulting button picture using <strong>File &gt; Save for Web &amp; Devices &gt; Preset : PNG-24 &gt; Save</strong> I have saved it as <strong>bg_button2.png</strong></p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_38hs4w5scc_b.jpg" alt="" width="330" height="265" /></p>
<p>Then you need to perform exactly the same steps for <strong>the reflection</strong> of the button. So basically you need to have 2 <strong>.png</strong> files before we move on to <strong>Flash</strong> animation: <strong>bg_button.png</strong> and <strong>reflection.png</strong></p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_39g9c3vqd8_b.jpg" alt="" /></p>
<p><strong><span style="text-decoration: underline;">Step 9</span>: <em>first steps in Flash (importing files &amp; inserting layers)</em></strong></p>
<p><strong><em> </em></strong></p>
<p>Open <strong>Adobe Flash CS3</strong> and create a new <strong>Flash File (ActionScript 2)</strong> document. You will need to import 2 image files to library : <strong>bg_button.png</strong> and <strong>reflection.png</strong>. This can be done either by using <strong>File &gt; Import &gt; Import to library</strong> or you can simply <strong>drag&#8217;n'drop</strong> files into the library window.<br />
<strong><br />
</strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_40hdn6rsp6_b.jpg" alt="" /></p>
<p><img alt="" /><br />
Drag-n-drop <strong>bg_button.png</strong> to the workspace and convert this object to a <strong>Movie Clip</strong>. This can be done by <strong>Rightclick</strong> <strong>&gt; Convert To Symbol &gt; Movie Clip</strong> or you can simply highlight it with <strong>Selection Tool</strong> (black arrow) and press <strong>F8</strong>. Let&#8217;s name this movie clip &#8220;<strong>whole button</strong>&#8220;.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_41dck6s9d5_b.jpg" alt="" width="476" height="205" /></p>
<p>After the movie clip is created <strong>doubleclick</strong> on the button image to enter it. You will see that in the address bar <strong>&#8220;whole button&#8221;</strong> movie clip appeared right after the &#8220;<strong>Scene 1</strong>&#8220;. Now we will need to create movie clips for each of the objects of the <strong>&#8220;whole button&#8221;</strong>, there are 3 of them: <strong>button itself</strong>, <strong>reflection</strong> and <strong>text</strong>. Each movie clip should have its own layer and we will need to create 2 more layers called <strong>&#8220;action&#8221;</strong> and <strong>&#8220;button area&#8221;</strong>. Thus I have created 5 total layers with the names: <strong>button, reflection, text, action, button area.<br />
</strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_42hzs7qd8_b.jpg" alt="" /></strong></p>
<p><strong><strong><span style="text-decoration: underline;">Step 10</span>: <em>creating Movie Clips</em></strong></strong></p>
<p><strong> </strong></p>
<p>Please pay attention that &#8220;<strong>Layer 1&#8243;</strong> was renamed to &#8220;<strong>button&#8221;</strong> and it still contains the picture of a button. Let&#8217;s select this picture and <strong>convert it to a movie</strong> by pressing <strong>F8</strong>. I have named it &#8220;<strong>mc_button_back</strong>&#8221; and it is under the <strong>&#8220;button&#8221;</strong> layer. Now you will need to select &#8220;<strong>reflection</strong>&#8221; layer, drag-n-drop <strong>reflection.png</strong> from library right under the button (you can use arrow keys to move it more precisely). After this is done press <strong>F8</strong> and <strong>convert it to movie</strong> as well. I have named it &#8220;<strong>mc_reflection</strong>&#8220;. The next step is to add some text to a button.  Choose the &#8220;<strong>text</strong>&#8221; layer, select <strong>Text Tool</strong> and insert some text on the button. You can easily edit the text style by referring to <strong>Properties menu</strong>.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_432t8p78f2_b.jpg" alt="" /><br />
After setting this up convert the text to <strong>Movie clip</strong> by pressing <strong>F8</strong>. I have named it <strong>&#8220;mc_text&#8221;.</strong> This way we have all our button parts in places and your library should look like this:</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_44fp6d8fd8_b.jpg" alt="" /><br />
<strong><strong><strong><span style="text-decoration: underline;">Step 11</span>: <em>using Timeline &amp; setting an amplitude</em></strong></strong></strong></p>
<p><strong><strong><strong><em> </em></strong></strong></strong></p>
<p>The next step will be to make the button jump and return while hanging a mouse cursor over it. For this purpose we will need to use the <strong>Timeline</strong>.  Let&#8217;s have <strong>10 frames</strong> for button to jump <strong>up </strong>and another <strong>10 frames</strong> to go back <strong>down</strong>. Highlight the first frames of <strong>text</strong>, <strong>reflection</strong> and <strong>button </strong>layers. Press <strong>Alt</strong> and holding it <strong>drag</strong> them to the <strong>10th</strong> frame of the Timeline and release the mouse button. This will copy the frames. Repeat the procedure and copy those three frames further to the <strong>20th</strong> frame.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_45c9mqphgp_b.jpg" alt="" /></p>
<p>The next step will be to define the <strong>amplitude</strong> assigned to button jumping action. Highlight the 10th frame under the &#8220;<strong>button</strong>&#8221; layer. Be sure that you are using the <strong>Selection Tool</strong>, and define the position of a button in its highest point. Then go to &#8220;<strong>reflection</strong>&#8221; layer and move the reflection a little down, using the down arrow or moving it with the <strong>Selection Tool</strong>. And absolutely the same way fit the text to a button that has jumped up. Now we should have a nice button that is flying above the ground and the reflection slightly moved down.</p>
<p><strong><strong><strong><span style="text-decoration: underline;">Step 12</span>: <em>defining actions<br />
</em></strong></strong></strong></p>
<p>Highlight the &#8220;<strong>action</strong>&#8221; layer. Click on the very first frame and <strong>insert a keyframe</strong>. This can be done by pressing <strong>F6</strong>, or <strong>rightclick &gt; Insert keyframe, </strong>or in the manu above go<strong> Insert </strong><strong>&gt; Timeline &gt; Keyframe</strong>. Then highlight the <strong>10th</strong> frame and press <strong>F6. </strong>Do the same for <strong>20th </strong>frame. Then insert <strong>keyframes</strong> for the <strong>2nd</strong> and <strong>11th</strong> frames. You will have something like this:</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_46dwhqdhpp_b.jpg" alt="" /></p>
<p>Now we will have to define some <strong>keywords</strong> for our action script to refer to. Let&#8217;s <strong>insert an action</strong> to the <strong>1st</strong> and <strong>10th</strong> keyframe of the &#8220;<strong>action</strong>&#8221; layer. This can be done by highlighting a keyframe and pressing <strong>F9</strong>, or you can use <strong>right click</strong> and choose <strong>action</strong> from the dropdown menu. What you need to type in the appeared window is just:  <strong>stop();<br />
</strong></p>
<p><strong><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_47dbwb4mdz_b.jpg" alt="" /></strong></p>
<p><strong> </strong></p>
<p>Don&#8217;t forget to do the same for the <strong>10th</strong> keyframe! Ok. We are almost done with the <strong>&#8220;action&#8221;</strong> layer. Let&#8217;s define the frame names of the <strong>2nd</strong> and <strong>11th</strong> frames. This is done by highlighting a frame and looking down at the <strong>Properties menu</strong>. Name the <strong>2nd</strong> frame &#8220;<strong>over</strong>&#8221; and the <strong>11th</strong> &#8220;<strong>out</strong>&#8220;.<br />
<img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_48d5z4shg6_b.jpg" alt="" /><br />
<strong><strong><strong><span style="text-decoration: underline;">Step 13</span>: <em>creating a button</em></strong></strong></strong></p>
<p><strong><strong><strong><em> </em></strong></strong></strong></p>
<p>Now let&#8217;s finish with automatization. Highlight the &#8220;<strong>button area</strong>&#8221; layer and chose the <strong>Rectangle Tool</strong>. We will need to create a rectangular which will cover our button. (if it does not let you, ensure that you have at least one <strong>frame</strong> in the &#8220;<strong>button</strong>&#8221; layer) Then convert the rectangular to a <strong>Button. </strong>I have named it &#8220;<strong>button action</strong>&#8221;</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_49gz6mbr5z_b.jpg" alt="" /><br />
Now <strong>double click</strong> it and you will go inside the button. Under <strong>Layer 1</strong> hold the first frame with your mouse left button and drag it till the <strong>Hit</strong> column.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_50g2vfs2tt_b.jpg" alt="" /></p>
<p>To get out of the editing this action you can click somewhere outside the grey rectangle or click the &#8220;<strong>whole button</strong>&#8221; in the navigation bar.<br />
<strong><strong><strong><span style="text-decoration: underline;">Step 14</span>: <em>Setting up animation</em></strong></strong></strong></p>
<p>Now when you can see that your button is <strong>blurred</strong>. It&#8217;s ok. Next we will need to insert some code into this button area to have it working. Press <strong>F9</strong> while having our blurred rectangular chosen and insert the next into the action window:</p>
<p><strong>on(rollOver)</strong></p>
<p><strong>{</strong></p>
<p><strong> gotoAndPlay(&#8220;over&#8221;);</strong></p>
<p><strong>}</strong></p>
<p><strong>on(rollOut)</strong></p>
<p><strong>{</strong></p>
<p><strong> gotoAndPlay(&#8220;out&#8221;);</strong></p>
<p><strong>}</strong><br />
<img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_51cf834gd4_b.jpg" alt="" /></p>
<p>Now we wiil need to define the action itself. Highlight some part of the timeframe for <strong>3</strong> of our objects so that <strong>10th</strong> frame was in the center of the selection. Go down to <strong>Properties</strong> and choose the <strong>Motion</strong> setting for <strong>Tween.</strong><br />
<img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_52ds9zqxcr_b.jpg" alt="" /><strong><strong><strong><span style="text-decoration: underline;"><br />
Step 15</span>: <em>Setting up the framerate and spreading the button area</em></strong></strong></strong></p>
<p><strong><strong><strong><em> </em></strong></strong></strong></p>
<p>The next step will be to set <strong>framerate</strong> to have or button jump faster. This is done by <strong>double clicking</strong> the current frame number.  Use 31 frames per second.<br />
<img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_53dxz9r7sk_b.jpg" alt="" /><br />
And the last thing that needs to be done for button to work &#8211; we must spread the &#8220;<strong>button area</strong>&#8221; layer from <strong>1st</strong> to <strong>20th</strong> frame. You can just click on <strong>20th</strong> frame and press <strong>F5</strong> for it to be done.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_54cf2cfxds_b.jpg" alt="" /><br />
Our &#8220;<strong>whole button</strong>&#8221; is ready now! Congrats!  You can get out of the button by double clicking outside of it, or pressing <strong>Scene 1</strong>. You can press <strong>Ctrl</strong> + <strong>Enter</strong> to see how well it jumps!</p>
<p><strong><strong><strong><span style="text-decoration: underline;">Step 16</span>: <em>Some more tips</em></strong></strong></strong></p>
<p>Still there are <strong>some tricks</strong> we can do about it. I&#8217;ll show you some of them:</p>
<p>When highlighting the frames area for 3 objects you can set the <strong>Ease</strong> parameter for the button to go smoother. Set it to <strong>100</strong> and see the result!</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_55gjr33kgn_b.jpg" alt="" /><br />
And to have our button animation even more sophisticated we can make the text change its color. For this purpose you will need to refer to the <strong>10th</strong> frame of the &#8220;<strong>text</strong>&#8221; layer. Select the text with the <strong>Selection Tool</strong> and go down to the <strong>Properties</strong> section. In the <strong>Color</strong> drop-down box choose <strong>Tint</strong> and assign black color to the text.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_56f5d75ddc_b.jpg" alt="" /></p>
<p><strong><strong><strong><span style="text-decoration: underline;">Step 17</span>: compiling the whole flash menu</strong></strong></strong></p>
<p>At last we have our button ready! Now we need to <strong>clone</strong> it and compile the whole menu! Let&#8217;s <strong>duplicate</strong> our home button <strong>movie clip</strong> to make a separate movie clip for each button.</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_57fp4c5wfn_b.jpg" alt="" /></p>
<p>Then ensure that your current place is <strong>Scene 1</strong>, not the &#8220;<strong>whole button&#8221;</strong> and <strong>drag-n-drop</strong> newly created buttons to have the full flash menu. After this we will need to have a separate text movie for each button. You already know how to do this. Just delete the original one from each button, and create its own movie clip for each button.</p>
<p>Your <strong>Flash Menu</strong> is now <strong>complete</strong>. Now you can add another layer at <strong>Scene 1</strong> and draw a big black rectangle for background and our menu is done!</p>
<p><img src="http://tuts.flashmint.com/wp-content/uploads/flashmenu/dhbfv849_58fv894rnk_b.jpg" alt="" /></p>
<p>Here you can check the live DEMO of our COOL flash menu:</p>
<p><object width="550" height="400" data="http://tuts.flashmint.com/wp-content/uploads/main.swf" type="application/x-shockwave-flash"><param name="src" value="http://tuts.flashmint.com/wp-content/uploads/main.swf" /><param name="quality" value="high" /></object></p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/creating-flash-menu-tutorial/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/creating-flash-menu-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Edit Flash XML Template</title>
		<link>http://tuts.flashmint.com/how-to-edit-flash-xml-template/</link>
		<comments>http://tuts.flashmint.com/how-to-edit-flash-xml-template/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 14:30:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[flash components]]></category>
		<category><![CDATA[flash templates]]></category>
		<category><![CDATA[flash xml]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=93</guid>
		<description><![CDATA[If you seek to create a flash website with minimal expenses, buying or downloading a free flash template is probably the best solution for you. Though, any template demands customization. The least you need to do with is insert your logo, contact info, text and pictures. But it is also very likely that you will [...]]]></description>
			<content:encoded><![CDATA[<div>If you seek to create a <a href="http://www.flashmint.com/" target="_self">flash website</a> with minimal expenses, buying or downloading a free flash template is probably the best solution for you. Though, any template demands customization. The least you need to do with is insert your logo, contact info, text and pictures. But it is also very likely that you will need to make some changes in the menu structure (add or remove some components), you might want to change some of the colors, i.e. button colors, colors on the background or anything else.<br />
If you don&#8217;t want to pay for customization you can do it yourself, all you need to know for this are just some basic steps.<br />
This tutorial was written especially for you, so that you don&#8217;t have to pay money for <a href="http://www.flashmint.com/show-type-flash.html" target="_self">flash templates</a> customization and don&#8217;t get lost in your xml files when trying to do it yourself.<br />
As an example I&#8217;ve taken one of the Flash Mint website templates, and I shall use it as an example for you, so that you can understand what I will be talking about.<br />
As you purchase or download a flash template you receive it as a template package which consists of all the template-related files, including source code files and content. After you have figured out what changes you want to do about your template, you need to open this folder. All the changes you need will be done with the files in this folder.</div>
<div><span id="more-93"></span></div>
<div>
<p><strong>Website structure (main menu)</strong><br />
The structure of your flash template is determined in XML file. Mine is called &#8220;structure&#8221;, yours might have a different but still somewhat similar to this name. This document lists all the components of the main menu, as well as the sub menu components. If you want to delete, add or change elements from the main menu you need  to:<br />
1. Open the structure xml file.<br />
2. To delete one of the menu elements you need to find this item in the code. Then highlight this piece of code and press delete. For example, to delete the News section from my main menu I highlight the whole phrase in the code that describes this element and delete it.<br />
<strong><span>Template file folder</span></strong><strong><span> →</span></strong><strong><span> Structure file → </span><span class="m">&lt;</span><span class="t">item</span> <span class="t">name</span><span class="m">=&#8221;</span></strong><strong>NEWS</strong><strong><span class="m">&#8220;</span> <span class="m">&#8230; /&gt; </span><span>→ DELETE</span></strong><br />
3. To add an element to the main menu, first you have to add the same piece of code as for the other elements, only with the item name you need. Save the file.<br />
<strong><span>Structure file → </span><span class="m">&lt;</span><span class="t">item</span> <span class="t">name</span><span class="m">=&#8221;</span></strong><strong>NEW BUTTON</strong><strong><span class="m">&#8220;</span> <span class="m">&#8230; /&gt; </span><span>→ INSERT</span></strong><br />
4. But in such a way you will add only a new button to the main menu. It will lead you to the same page where the button you&#8217;ve copied the code from did. To make it lead to another page you need to create one. The easiest way to do it is to use a sample of the existing one (like if you need a second news block to show not only company news, but world news as well) or to buy a flash component  and simply insert it to your website (for example, you&#8217;ve purchased a template and you want to have an event planner on it).<br />
<strong><span>Template file folder </span>→ </strong><strong><span>NEW BUTTON FOLDER </span></strong><strong>→ </strong><strong>INSERT</strong><br />
To make your main menu button lead where you need, you have to write a new path to it. To do this, in the phrase you&#8217;ve inserted you need to change the value for componentPath and componentSWF. The new componentPath value will be a name of the new folder you need to insert into your folder with template files. If you have purchased a new flash component, you can insert the folder with this component files. If you are adding an element  similar to one of the existing ones, you can copy and rename its folder, and then customize the content of it according to the steps described below.<br />
<span>Structure File </span><strong>→ </strong><span class="m">&lt;</span><span class="t">item</span> <span class="t">name</span><span class="m">=&#8221;</span><strong>NEW BUTTON</strong><span class="m">&#8220;</span><span class="t"> type</span><span class="m">=&#8221;</span><strong>component</strong><span class="m">&#8220;</span><span class="t"> componentPath</span><span class="m">=&#8221;</span><strong>NEW BUTTON</strong><span class="m">&#8220;</span><span class="t"> componentSWF</span><span class="m">=&#8221;</span><strong>newbutton.swf</strong><span class="m">&#8220;</span><span class="t"> visible</span><span class="m">=&#8221;</span><strong>true</strong><span class="m">&#8221; /&gt;</span><br />
5. If you only need to change the name for one of the existing buttons, you can do it simply by giving a new value to <span>&lt;item name=&#8221;NEW NAME&#8221;.</span><br />
<em><strong>Colors of the main menu</strong></em><br />
If you need to change the colors of the main menu buttons, find a file in the template file folder, called colors. This file must be in the main folder, not in one of the component folders, as it describes properties of the main menu. To do the changes you need to put a new value for the color tag that describes the color of a certain element. The value is usually described by a special code, assigned to each of the web colors.<strong><br />
<span>Template file folder </span></strong><strong>→ colors file </strong><strong>→ </strong><strong><span class="m">&lt;</span><span class="t">buttons</span> <span class="t">mouseOver</span><span class="m">=&#8221;</span></strong><strong>0xa000d4&#8243;&#8230;/&gt;</strong><br />
<strong> <em>Logo </em></strong><br />
To put your logo on the template you need to put new logo picture into the folder instead of the old one. Mine is in the folder called Images.  Make sure the size and image type fits.<br />
<strong>Template file folder</strong> <strong>→ Images </strong><strong>→ Insert new image</strong></p>
<p><strong><br />
Homepage <a href="http://tuts.flashmint.com/wp-content/uploads/homepage.jpg"><img class="alignright size-full wp-image-94" title="homepage" src="http://tuts.flashmint.com/wp-content/uploads/homepage.jpg" alt="homepage" width="470" height="457" /></a></strong><br />
The homepage of my template is a slide show of pictures, where I have three pictures changing each other with a certain delay. I can substitute these pictures with the ones I need.<br />
1. First of all, I&#8217;ve got to look through files and folders in my template file folder  and find out where the pictures form my home page are. I&#8217;ve found mine in a folder called &#8220;Gallery&#8221;. It includes three pictures that I can see on my homepage as a slide show.<br />
To change the pictures to different ones I can put new pictures into my folder with pictures. To make them show up instead of the old ones, I need to put the names of these pictures into the code.<br />
<strong>Template file folder → Gallery </strong><strong>→ insert new images</strong><br />
2.If you want to have more pictures, you can just copy the code that inserts one (or more) picture, insert it once more and add the names of the pictures you want to show up.<br />
3.Now I need to find a code file describing how these pictures substitute each other and what is the delay time. In my template file folder there is a folder called data. It contains an XML file called &#8220;Gallery&#8221;. This file describes what pictures and how often appear on my homepage and other pages of my website as a background.<br />
4. To change the delay (make pictures change more/less often)  you just need to change the value for delay in this code file. The delay value is measured in seconds, so you can put &#8220;12&#8243;, &#8220;5&#8243;, &#8220;30&#8243; or any other number.<br />
<strong>Template file folder → Data </strong><strong>→ Gallery file </strong><strong>→</strong><strong> &lt;image &#8230;&#8230;delay=&#8221;new value&#8221;&#8230;/&gt;</strong><br />
6. Do not forget to save the code file each time you&#8217;ve done the changes, in other way they will not be applied.</p>
<p><strong></strong></div>
<div><strong>Slide show <a href="http://tuts.flashmint.com/wp-content/uploads/slide-show.jpg"><img class="alignright size-full wp-image-95" title="slide-show" src="http://tuts.flashmint.com/wp-content/uploads/slide-show.jpg" alt="slide-show" width="470" height="381" /></a></strong></div>
<div>
<p>1. My template includes a slide show component. If yours does not and you need it, you can get one from Flash Mint&#8217;s <a href="http://www.flashmint.com/show-type-flash-components.html" target="_self">flash components</a> gallery. Anyway, you will definitely need to customize this component, because you need to put your photos into the slide show. You might also want to change the background color and the color of buttons or the picture title.<br />
2. To do anything about your slide show you need to open a folder that has all the files describing your slide show. In my template files folder I have a slide show folder, it contains a folder with the pictures, an xml file that describes the order in which the pictures appear and one more xml file that describes the colors set for various elements in slide show.</p>
<p>3.  To change the pictures I need to add new pictures in the folder where the old ones are. Do not forget to re-size your pictures so that they fit.<br />
<strong>Template file folder </strong><strong>→ Slideshow folder </strong><strong>→ Items </strong><strong>→ insert new pictures</strong><br />
4. Then you need to put the names of these pictures into the code that describes the order of the pictures.<br />
<strong>Template file folder </strong><strong>→ Slideshow folder </strong> <strong>→ slideshow xml file </strong><strong>→ </strong><span class="m">&lt;</span><span class="t">item</span> <span class="t">image</span><span class="m">=&#8221;</span><strong>items/new image name.jpg</strong><span class="m">&#8221; /&gt;</span><br />
5. If you want to change anything about the colors you can open the XML file which describes the colors for this section of template and do the changes. For my template I can change the background color, the color of buttons and the main title color. To do this I need to put a new value for the color tag that describes the color of a certain element. The value is usually described by a special code. Such codes are assigned to all of the web colors. You can look up the one you need, for instance, <a id="na6d" title="here" href="http://www.computerhope.com/htmcolor.htm">here</a>.<br />
<strong>Template file folder </strong><strong>→ Slideshow folder</strong> <strong>→ colors xml file </strong><strong>→ new color numbers</strong></p>
<p><strong>News <a href="http://tuts.flashmint.com/wp-content/uploads/news.jpg"><img class="alignright size-full wp-image-96" title="news" src="http://tuts.flashmint.com/wp-content/uploads/news.jpg" alt="news" width="470" height="307" /></a></strong><br />
The news section is probably the one that demands to be changed more often than any other one. In my template news show up as a picture with short description, and as you click on it, you can read the whole text. In such a way, I need to put the pictures to be displayed and two pieces of text. And as for any other section of my website I can change the general colors.<br />
1. To add/delete news from the news section you need to find a folder with these files in your template files folder. Mine is called &#8220;dynamic_news&#8221;.<br />
2. Here I can find one more folder which is called &#8220;Items&#8221;  and it has all the news-related pictures in it. I can put new pictures here, though it is still important to remember about the image size.<br />
<strong>Template file folder → Dynamic News </strong><strong>→ items </strong><strong>→ New pictures for news</strong><br />
3. To make the new pictures displayed in my news, I have to open a code file (lies in the news folder). Here for each of the news there are several parameters given. Item thumbnail (the picture), title (title of the piece of news), description (a short text displayed by the picture), content (the whole text of this piece of news).<br />
To make your picture displayed you need to put your new picture name as a value for item thumbnail.<br />
<strong>Dynamic news → News XML file</strong> <strong>→</strong><span><span class="m"> &lt;</span><span class="t">item</span><span class="t"> thumbnail</span><span class="m">=&#8221;</span></span><span>items/category1/</span><strong>New Image for news 1.jpg<span class="m">&#8220;</span> </strong><span><span class="t">title</span></span><strong><span class="m">=&#8221;</span></strong><strong>News Title for news<span class="m">&#8220;</span></strong><br />
4. In a similar way  you can give a new title to your news, insert new texts for description and the whole text of the news. Just paste a new text between the description and content tags and do not forget to save your file.<br />
<strong>Dynamic news → News XML file </strong><strong>→ </strong><span class="m">&lt;</span><span class="t">content</span><span class="m">&gt; <strong>NEW CONTENT</strong>. &lt;</span><span class="t">/content</span><span class="m">&gt;</span><br />
5. You can edit the basic colors for this page as well. Just follow a procedure similar to the one described in Step 5 for the slide show.</p>
<p><strong>Media <a href="http://tuts.flashmint.com/wp-content/uploads/media.jpg"><img class="alignright size-full wp-image-97" title="media" src="http://tuts.flashmint.com/wp-content/uploads/media.jpg" alt="media" width="470" height="298" /></a></strong><br />
My template has image and video gallery components. They can be reached from Media in the main menu. Each of these galleries has its own folder in the main folder.<br />
<em><strong>Video gallery</strong></em><br />
1. To edit the contents of the video gallery I need to substitute the old videos with the ones I want to put here. So I insert into the folder with videos my new videos, and then open the code file and change the names for the videos.<br />
<span>Template file folder </span><strong>→ Video gallery </strong><strong>→ Items </strong><strong>→ New Videos</strong><br />
2. In my template besides the videos there are thumbnails for them, which appear as a preview, help navigation. There is also the description text for each video.<br />
3. The thumbnails are located in the same folder as video, so as I insert a new name for the video in the code file, I need to change the name for a thumbnail. Thumbnails are .jpeg files.<br />
4. Then I can insert the new description text into the code file.<br />
<span>Template file folder </span><strong>→ Video Gallery </strong><strong>→ Video XML file </strong><strong>→ &lt;</strong><span class="t">item item_icon</span><span class="m">=&#8221;</span><span>items/1/</span><strong>New video 1.</strong><span>jpg</span><span class="m">&#8220;</span><span class="t"> item</span><span class="m">=&#8221;</span><span>items/1/</span><strong>New video1.</strong><span>flv</span><span class="m">&#8220;</span><span class="t"> title</span><span class="m">=&#8221;</span><strong>New Video 1</strong><span class="m">&#8220;&gt;</span><br />
5. The same procedure must be done for every video, just make sure the names you insert into the code match the ones that are assigned to each video or thumbnail in the items folder.<br />
6. To edit the colors just open the colors XML file and and make the changes the same way like for other components.</p>
<p><em><strong>Image gallery</strong></em><br />
1. To customize your image gallery find a folder which contains the information on this gallery.<br />
2. Change the pictures in this folder to the ones you need. Pay attention to the image size and type.<br />
<strong>Template file folder →</strong><strong> <span>Images Gallery</span> </strong><strong>→ Items </strong><strong>→Insert New images</strong><br />
3. Substitute the names of the pictures in the code. Add the text you need. The procedure is pretty much the same as for videos, you&#8217;ll just be dealing with a different type of files.<br />
<strong>Template file folder → Images gallery </strong><strong>→ Images XML file</strong> <strong>→ new image names</strong><br />
4. To do the color changes just open a code file in this folder which describes colors and apply changes according to the steps described for previous components.</p>
<p><strong>About us <a href="http://tuts.flashmint.com/wp-content/uploads/about-us.jpg"><img class="alignright size-full wp-image-98" title="about-us" src="http://tuts.flashmint.com/wp-content/uploads/about-us.jpg" alt="about-us" width="470" height="217" /></a></strong><br />
In my template the About Us element is a menu that consists of four components. Three of them are text pages (philosophy, Testimonials and Services) and one is a Staff page where there are pictures and text near them.<br />
1.To make changes at the Staff Page I need to open the folder with the files about this page and add the new pictures of staff by putting them into the appropriate folder instead of old ones.<br />
Template file folder <strong>→ Staff page </strong><strong>→ Items </strong><strong>→ Insert New pictures</strong><br />
2. Then I can open the code file of this page and insert new picture names.<br />
<span>Staff page </span><strong>→ Staff page XML file</strong> <strong>→</strong><span class="m">&lt;</span><span class="t">item thumbnail</span><span class="m">=&#8221;</span><strong>items/1/New staff image.jpg</strong><span class="m">&#8220;</span><span class="t"> title</span><span class="m">=&#8221; New </span><strong>Photo 1</strong><span class="m">&#8220;&gt;</span><br />
3. The text can be simply inserted by replacing the old one in this code file for each picture separately.<br />
<span>Staff page </span><strong>→ Staff page XML file</strong> <strong>→</strong> <span class="m">&lt;![CDATA[ <strong>New Content </strong>]]&gt;</span><br />
4. If you need to add more entries than there initially were just duplicate a piece of code and change the values. If you need to have less, simply delete the items you don&#8217;t need.<br />
5. And of course, you can change the colors the same way as for the other components of the menu.</p>
<p>To insert the new text into the text pages just open the folder with the files on this page and replace the content between the content tags in the code file. Do not forget to save the file each time you make changes, so that they get applied!</p>
<p><strong>Contact Page <a href="http://tuts.flashmint.com/wp-content/uploads/contact-page.jpg"><img class="alignright size-full wp-image-99" title="contact-page" src="http://tuts.flashmint.com/wp-content/uploads/contact-page.jpg" alt="contact-page" width="470" height="380" /></a></strong><br />
1. To change your contact data open the contact page folder, and change the data in the code file by substituting the old info with the new one. Save.<br />
<strong>Template files folder →</strong><strong> Contact page </strong><strong>→ </strong><strong>Contact page XML file</strong><br />
2. You can open colors XML file for this page to do the color changes you wish.</p>
<p><strong>Sound</strong><br />
If there is a background sound in your template and you want to change it, just put new tracks instead of old ones in the template file folder. If your track names differ from the old ones you need to change them in the sound code file as well.<br />
<strong>Template file folder</strong> <strong>→Sound XML file </strong><strong>→</strong><span class="m"> &lt;</span><span class="t">item</span> <span class="t">name</span><span class="m">=&#8221;</span><strong>New Track 1 &#8211; Unknown Artist</strong><span class="m">&#8220;</span><span class="t"> url</span><span class="m">=&#8221;</span><strong>New track.mp3</strong><span class="m">&#8221; /&gt;</span></div>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/how-to-edit-flash-xml-template/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/how-to-edit-flash-xml-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Advanced Preloader with Reflection</title>
		<link>http://tuts.flashmint.com/advanced-preloader-with-reflection/</link>
		<comments>http://tuts.flashmint.com/advanced-preloader-with-reflection/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 12:52:42 +0000</pubDate>
		<dc:creator>Dan Doicaru</dc:creator>
				<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[action script]]></category>
		<category><![CDATA[flashmovie]]></category>
		<category><![CDATA[movieclips]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=36</guid>
		<description><![CDATA[In this tutorial we will create an advanced blue preloader with beautiful reflection effect and a big easing text. This requires a little knowledge about animations and action scripting. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://tuts.flashmint.com/wp-content/uploads/preview1.jpg"><img class="alignleft size-full wp-image-59" title="preview1" src="http://tuts.flashmint.com/wp-content/uploads/preview1.jpg" alt="preview1" width="200" height="200" style="border: 5px solid #d5d5d5" /></a></p>
<p>In this tutorial we will create an advanced blue preloader with beautiful reflection effect and a big easing text. This requires a little knowledge about animations and action scripting.<br />
<span id="more-36"></span></p>
<div class="fixed"></div>
<p><strong>About the Author:</strong><br />
Hi. I`m Danny, a freelancer web developer from Romania and I like to write interesting tutorials in Flash and Photoshop. You can visit my website for more great and useful tutorials: <a href="http://www.extremestudio.ro/" target="_blank">Extreme Design Studio</a>.<br/><br/></p>
<h1>Advanced Preloader with Reflection</h1>
<p><br/><br/><br />
<strong style="font-size:24px">Step 1</strong></p>
<p>Create a new file with Action Script 2.0 and go to Modify – Document (CTRL+J) and do the settings below:</p>
<p style="text-align: center;"><img class="size-full wp-image-39 aligncenter" title="1" src="http://tuts.flashmint.com/wp-content/uploads/1.jpg" alt="1" width="500" height="400" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED"/></p>
<p>Import to scene (CTRL+R) the two main images <em>bar.png</em> and <em>bar_h.png</em> and put the half bar under the full bar and align them to middle. Right click on each object and convert it to a movieclip (F8) and rename the first layer to <em>preloader </em>and apply the glow filter and set the alpha to 50.</p>
<p style="text-align: center;"><img class="size-full wp-image-40 aligncenter" title="2" src="http://tuts.flashmint.com/wp-content/uploads/2.jpg" alt="2" width="500" height="300" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED"/></p>
<p style="text-align: left;"><strong style="font-size:24px">Step 2</strong></p>
<p style="text-align: left;">Select both bars and press F8 to convert them in a single movieclip. Double click the object. Inside the movieclip will be the main animation. Now select again the two bars and press F8 to convert them in a single movieclip. Repeat this once more to have the possibility to set the alpha to 0 for the both bars.</p>
<p>Double click again on the movieclip and now you must be inside of a two movieclips. Very good. Now insert a keyframe (F6) on the frame 10 then right click on the frame 1 and select <em>Create Motion Tween</em>. Select frame 1 and click on your object. In the Properties Panel you will find the option Color and set it to Alpha 0.</p>
<p>Ok now we have the animation for our bars. Right click on the frame 20 and select Action (F9) and write <strong>stop()</strong>;</p>
<p style="text-align: center;"><img class="size-full wp-image-41 aligncenter" title="3" src="http://tuts.flashmint.com/wp-content/uploads/3.jpg" alt="3" width="500" height="430" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED" /></p>
<p><strong style="font-size:24px">Step 3</strong><br />
On the timeline bar click on the second movieclip to return. On the image above the second movieclip is named as <em>Symbol 5</em>. Double click Layer 1 icon and mark <em>View layer as outlines</em> and rename it to <em>bars</em>.</p>
<p>Insert a keyframe on the frame 3 and copy your bar (CTRL+C) and paste in place (CTRL+SHIFT+V) and move it with 10 pixels using SHIFT + Right Arrow.</p>
<p>Repeat this step for every uneven frame (Frame 5 &#8211; 3 bars, Frame 7 &#8211; Frame 4 bars&#8230; until you reach frame 100).<br />
You don&#8217;t need to make 50 bars. Try to insert 2 or 3 frames until you reach frame 100. See the picture below:</p>
<p style="text-align: center;"><img class="size-full wp-image-42 aligncenter" title="4" src="http://tuts.flashmint.com/wp-content/uploads/4.jpg" alt="4" width="500" height="300" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED"/></p>
<p><strong style="font-size:24px">Step 4</strong><br />
Insert a new layer and rename it to <em>percent</em>. With the Text Tool (T) create a text<em> 100%</em>. Use Arial font with size 50 and left aligned. Instance field should be <em>txt_mc </em>and var field should be <em>txt </em>and don&#8217;t forget to <em>embed numerals and punctuations</em>.</p>
<p style="text-align: center;"><img class="size-full wp-image-43 aligncenter" title="5" src="http://tuts.flashmint.com/wp-content/uploads/5.jpg" alt="5" width="500" height="300" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED"/></p>
<p><strong style="font-size:24px">Step 5</strong><br />
Very good now we must add a movieclip to move the text using action script. Insert a new layer and rename it to <em>move</em>. With the Rectangle Tool (R) draw a small white rectangle and convert it to movieclip (F8) with alpha 0, instance name <em>moving </em>and the X Axis same like the text. Insert a keyframe to frame 100 and move the object at the end of lines. Try to view the picture below:</p>
<p style="text-align: center;"><img class="size-full wp-image-44 aligncenter" title="6" src="http://tuts.flashmint.com/wp-content/uploads/6.jpg" alt="6" width="500" height="300" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED"/></p>
<p><strong style="font-size:24px">Step 6</strong><br />
Return to Main Scene, right click on the movieclip and select Actions (F9) and write the following code:</p>
<p>onClipEvent(load) {<br />
total = _root.getBytesTotal();<br />
}</p>
<p>onClipEvent(enterFrame) {<br />
loaded = _root.getBytesLoaded();<br />
percent = int(loaded/total*100);<br />
txt = +percent+&#8221;%&#8221;;<br />
txt_mc._x = moving._x;<br />
gotoAndStop(percent);<br />
if (loaded == total) {<br />
_root.gotoAndPlay(2);<br />
}<br />
}</p>
<p>Now add a keyframe on frame 2 and put stop(); for the both frames (F9). On the frame 2 you can put a text field with Content Loaded and a big image to test your preloader.</p>
<p style="text-align: center;"><img class="size-full wp-image-45 aligncenter" title="7" src="http://tuts.flashmint.com/wp-content/uploads/7.jpg" alt="7" width="500" height="300" style="border:1px #d5d5d5 solid; padding:10px"; background:#EDEDED" /></p>
<p><strong style="font-size:24px">Final Work</strong></p>
<p><object width="400" height="300" data="http://tuts.flashmint.com/wp-content/uploads/adv_preloader_preview.swf" type="application/x-shockwave-flash"><param name="src" value="http://tuts.flashmint.com/wp-content/uploads/adv_preloader_preview.swf" /><param name="quality" value="high" /></object></p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/advanced-preloader-with-reflection/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/advanced-preloader-with-reflection/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>What Flash Tutorials will be Published at FlashMint Tuts?</title>
		<link>http://tuts.flashmint.com/what-flash-tutorials-will-be-published-at-flashmint-tuts/</link>
		<comments>http://tuts.flashmint.com/what-flash-tutorials-will-be-published-at-flashmint-tuts/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 09:12:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[flash tutorials overview]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=17</guid>
		<description><![CDATA[We accept step-by-step tutorials and How-to’s that contain text and screenshots formatted in HTML. Each tutorial should start with a title, preview image (200*200) and a descriptive excerpt for the main page. After the introduction there will be a ‘Preview’ heading with your live demo or video embedded under that. The tutorial itself should be [...]]]></description>
			<content:encoded><![CDATA[<p>We accept step-by-step tutorials and How-to’s that contain text and screenshots formatted in HTML.</p>
<p>Each tutorial should start with a title, preview image (200*200) and a descriptive excerpt for the main page.</p>
<p>After the introduction there will be a ‘Preview’ heading with your live demo or video embedded under that.</p>
<p>The tutorial itself should be laid out in numbered steps, starting with Step 1 containing an illustrative screenshot. The layout is repeated for each step until the tutorial is complete.</p>
<p>To create the coherent structure outlined above you’ll need to utilize some HTML tags like &lt;h2&gt; &lt;/h2&gt;, &lt;p&gt; &lt;/p&gt;, &lt;em&gt; &lt;/em&gt;. As such, your tutorial will need to be created in a HTML file. It’s best to format your tutorial in a text editor like Notepad or a WYSIWYG program like Dreamweaver. It must be saved with a .html extension (i.e. yourtutorial.html).</p>
<p>Please note that every step in your tutorial should be illustrated with a screenshot unless it is blindingly clear. Image size should be 500*500 pixels. Each image should contain a readable UI area.</p>
<p>Number every image in order of appearance: the first image should be titled 1.jpg, your twentieth should be titled 20.jpg, and so on.<br />
Use the following code for an image to appear in your tutorial:<br />
&lt;div class=”tutorial_image”&gt;&lt;img src=”-1.jpg” alt=”” /&gt;&lt;/div&gt;.</p>
<p><strong>Flash Tutorial Intro Preview</strong></p>
<p>Every tutorial should start with a preview of the finished product. This preview should be 500px wide or less.<br />
Live demo is the best way to preview a Flash effect. On the tutorial page you can embed animations. If you are having trouble creating your live demo or creating a place to host it, get in touch with us and we will find a solution.</p>
<p><strong>What to Submit</strong></p>
<p>Before submitting your Flash tutorial, create a .ZIP file with two folders: ‘Tutorial’ and ‘Preview’. Tutorial folder includes your formatted HTML tutorial and your tutorial images and a Preview folder which includes your preview files and a 200 x 200 pixel preview image. If the .ZIP file is over 10 MB use an online file transfer service for delivery. Send your tutorial to marketing (at) flashmint (dot) com</p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/what-flash-tutorials-will-be-published-at-flashmint-tuts/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/what-flash-tutorials-will-be-published-at-flashmint-tuts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Welcome To The Unique Fount Of Flash Tutorials</title>
		<link>http://tuts.flashmint.com/welcome-to-the-unique-fount-of-flash-tutorials/</link>
		<comments>http://tuts.flashmint.com/welcome-to-the-unique-fount-of-flash-tutorials/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 11:24:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[flash tutorials overview]]></category>

		<guid isPermaLink="false">http://tuts.flashmint.com/?p=12</guid>
		<description><![CDATA[All the web developers and Flash lovers of the world come together! We are glad to welcome you at FlashMint Tuts &#8211; an unmatched one-stop solution for everyone who seeks professional help for designing Flash applications or wants to share some rare and useful findings with other webmasters. Flash is a tool for creating interactive [...]]]></description>
			<content:encoded><![CDATA[<p>All the web developers and Flash lovers of the world come together! We are glad to welcome you at FlashMint Tuts &#8211; an unmatched one-stop solution for everyone who seeks professional help for designing Flash applications or wants to share some rare and useful findings with other webmasters.</p>
<p>Flash is a tool for creating interactive and animated Web site. These Flash tutorials will teach you how to use Flash in your web designs. The mission of FlashMint Tuts is to be your reference guide to mastering your Flash scripting, learning new Flash effects and Flash concepts. Every technique presented at FlashMint Tuts can be easily implemented into your professional Flash work.</p>
<p>Here you will find exclusive and most sufficient <strong>Flash tutorials</strong> which will help you to solve any issue arising in the process of developing Flash powered web pages. Besides, your assistance is always appreciated and even required so feel free to add <strong>Flash tips</strong> <strong>and tutorials</strong> to fill the incredible FlashTuts collection. Moreover, you have the real opportunity to earn from the collaboration so use your chance to make some profit with minimum efforts and maximum pleasure.</p>
<p><strong>What we’re looking for in tutorials</strong></p>
<p>At FlashMint Tuts we are not looking for quick tips for beginners. We are looking for comprehensive, multi-step tutorials that create a complex and high-end final result on the following topics:</p>
<p>•    Flash animation and interactivity<br />
•    Flash web design and user interfaces<br />
•    Flash applications</p>
<p><strong>Flash Tutorials Acceptance</strong></p>
<p>Before starting, please contact us for the tutorial concept and ideas. We would only reject a tutorial if it did not adhere to the basic requirements listed here, or if the final effect was amateurish.<br />
# If you’re not sure, send a sample of your work.<br />
# Spell check before sending your post.<br />
# We reserve the right to edit your post (h3 and strong tags, punctuation, grammar, etc…)<br />
You agree that the post was not previously and will never be republished elsewhere.</p>
<p><em>Note on Plagiarism</em></p>
<p>Please, if you submit a tutorial for publication on FlashMint Tuts, make sure it is an original article.<br />
Since direct copy and pasting is obvious plagiarism; paraphrasing, where the author would base the tutorial on another tutorial, but write it out in his/her own words, is just as unacceptable as copying and pasting.</p>
<p><strong>Getting paid</strong></p>
<p>As a freelance contributor you will be paid $150 per tutorial via PayPal (unless otherwise specified). Payments are made at the beginning of each month.</p>
<p><strong>Author Profile </strong></p>
<p>As an author, you will be featured on the top of each tutorial you send. With your first tutorial you should also submit your website URL, short bio and an email address that is attached to a <a href="http://gravatar.com" target="_blank">Gravatar</a> account.<br />
Our aim is to create the most powerful <strong>Flash knowledge base</strong> in one place so join us right away and enjoy the advanced facilities of Flash design.</p>
<div id="fb-like" style=""><iframe src="http://www.facebook.com/plugins/like.php?href=http://tuts.flashmint.com/welcome-to-the-unique-fount-of-flash-tutorials/&amp;layout=button_count&amp;show_faces=false&amp;width=50&amp;action=like&amp;font=&amp;colorscheme=light&amp;locale=en_US" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:50px; height:25px"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://tuts.flashmint.com/welcome-to-the-unique-fount-of-flash-tutorials/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
