<?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>Minervity &#187; Flash</title>
	<atom:link href="http://www.minervity.com/category/features/flash_tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.minervity.com</link>
	<description>Web / Graphic Design, Tutorials, Programming, Inspiration - Touch The Edge</description>
	<lastBuildDate>Tue, 06 Jul 2010 03:59:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>5 Different Ways To Create Stylish Contact Form Layouts</title>
		<link>http://www.minervity.com/features/php_scripts/5-different-ways-to-create-stylish-contact-form-layouts/</link>
		<comments>http://www.minervity.com/features/php_scripts/5-different-ways-to-create-stylish-contact-form-layouts/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 02:38:01 +0000</pubDate>
		<dc:creator>Richard Darell</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Contact Form]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Graphic]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[Stylish]]></category>
		<category><![CDATA[Website]]></category>

		<guid isPermaLink="false">http://www.minervity.com/?p=2903</guid>
		<description><![CDATA[We have all struggled with the contact for layout. What to include, how much info and how the layout should grace our ever so beautiful website design. I myself had quite a struggle finding the ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-3033" style="margin-right:20px; margin-bottom:40px;" title="CSS/PHP/AJAX/Flash Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/article-title-image1.jpg" alt="CSS/PHP/AJAX/Flash Contact Form" width="200" height="225" />We have all struggled with the contact for layout. What to include, how much info and how the layout should grace our ever so beautiful website design. I myself had quite a struggle finding the right one for the contact form for Minervity.com. Think I&#8217;ve found it but haven&#8217;t incorporated it yet. Yup, you guys have to get your fix before I start tweaking this site.</p>
<p>So, like a superhero looking for the criminals, I went out on the Internet to see if I could track down some of the best ways and most functional contact forms available. In this article you will find what I found with complementary downloadable code to set up your form.</p>
<p>Enjoy!</p>
<h2 style="margin-top:20px;">1. HTML Contact Form</h2>
<blockquote><p><img class="alignleft size-full wp-image-2909" style="margin-right:20px; margin-bottom:20px;" title="Simple Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/simple-contact-form.jpg" alt="Simple Contact Form" width="276" height="595" /></p>
<p>This stylish but simple contact form can complement just about any website in a good way. Its simple and straight forward layout makes for an easy way for the visitor to get in touch with you.</p>
<p>The form consists of three sections. Name, Address and Message. Each with its own input fields where the visitor can submit his contact info. You can easily change the border color, background color and setup even more fields if you so need.</p>
<p>You are allowed to change it, add or remove fields that you see fit your needs. You can of course set the tables width to fit the theme of your website or blog.</p>
<p>To change the names of the input fields which will allow you to generate nicely formatted results after submission you can just change the names of the fields to complement the field names used in the delivery system you are using. Consult your server provider to make sure what names they are using in their delivery system.</p>
<p style="text-align: center;"><a title="Simple Contact Form - File - Download" href="http://www.minervity.com/wp-content/plugins/download-monitor/download.php?id=2"><img class="aligncenter size-full wp-image-2954" style="margin-bottom: 70px;" title="Download Button - HTML Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/download-button-transparent2.png" alt="Download Button" width="235" height="75" /></a></p>
</blockquote>
<h2><span style="color: #000080;"><span style="color: #000000;">2. AJAX/PHP Contact Form</span></span></h2>
<blockquote><p><span style="color: #000080;"><span style="color: #000000;"><img class="alignleft size-full wp-image-2960" style="margin-right:20px;" title="LightForm AJAX/PHP Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/lightform-ajax-php-contact-form.jpg" alt="LightForm AJAX/PHP Contact Form" width="276" height="595" /></span></span></p>
<p>This form is a combined AJAX/PHP form using all kinds of fancy features. Simple to modify and a really nice addition to any website. It&#8217;s clean and stylish and depending on what you are after you can really add some great design flavor to your form.</p>
<p><strong><span style="color: #000080;"><span style="color: #000000;">Features include:</span></span></strong></p>
<ul>
<li><span style="color: #000080;"><span style="color: #000000;">Form Validation using FormCheck2.</span></span></li>
<li><span style="color: #000080;"><span style="color: #000000;">Spam Check.</span></span></li>
<li><span style="color: #000080;"><span style="color: #000000;">Display user IP, user agent and referrer in the message.</span></span></li>
<li><span style="color: #000080;"><span style="color: #000000;">Display a dialog box when message is sent successfully.</span></span></li>
<li><span style="color: #000080;"><span style="color: #000000;">Inputs and Text areas are styled with NiceForms.</span></span></li>
<li><span style="color: #000080;"><span style="color: #000000;">Works in the most recent browsers.</span></span></li>
</ul>
<p>All these features will make sure that your form is not only perfectly user friendly but also prevents nasty spam procedures from sending you annoying mass messages. If you should still get spam you can always block the IP address.</p>
<p><strong>Source:</strong> <a title="Website Link" href="http://web-kreation.com/demos/LightForm/" target="_blank">Web Kreation</a></p>
<p><a title="Download Button" href="http://www.minervity.com/wp-content/plugins/download-monitor/download.php?id=3"><img class="aligncenter size-full wp-image-2965" style="margin-bottom:60px;" title="Download Button - AJAX/PHP Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/download-button-transparent3.png" alt="Download Button - AJAX/PHP Contact Form" width="235" height="75" /></a></p></blockquote>
<h2>3. CSS/PHP Contact Form</h2>
<blockquote><p><img class="alignleft size-full wp-image-2978" style="margin-right:20px;" title="CSS/PHP Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/css-and-php-contact-form.jpg" alt="CSS/PHP Contact Form" width="276" height="595" /></p>
<p>This form is created using a combined technique of CSS and PHP to accomplish a stylish and really useful contact form for your website or blog.</p>
<p>It resembles the Simple HTML Contact Form but this one may be a bit more customizable and it has some nice and useful control features which will make it both user friendly and spam safe.</p>
<p><strong>Features include:</strong></p>
<ul>
<li>Required input field check,</li>
<li>Form validation using a simple <strong>captcha</strong> system.</li>
<li>Design modification friendly.</li>
<li>Streamlined user experience.</li>
</ul>
<p>Some really useful features to make sure that your form is fully and correctly filled out when the user submits it.</p>
<p>With a few modifications and graphics you can have a clean and professionally designed contact form for your blog or website.</p>
<p><strong>Source:</strong> <a title="Website Link" href="http://www.crazyleafdesign.com/blog/designing-a-stylish-contact-form-for-your-portfolio/" target="_blank">CrazyLeaf Design Blog</a></p>
<p><a title="Download Button" href="http://www.minervity.com/wp-content/plugins/download-monitor/download.php?id=4"><img class="aligncenter size-full wp-image-2980" style="margin-bottom:50px;" title="Download Button - CSS/PHP Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/download-button-transparent4.png" alt="Download Button - CSS/PHP Contact Form" width="235" height="75" /></a></p></blockquote>
<h2>4. Flash / PHP Contact Form</h2>
<blockquote><p><img class="alignleft size-full wp-image-2992" style="margin-right:20px;" title="Flash / PHP Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/flash-and-php-contact-form.jpg" alt="Flash / PHP Contact Form" width="276" height="595" /></p>
<p>This particular form uses Flash and PHP to create a simple but quite useful contact form. There isn&#8217;t any particular fancy features coming with this form but its streamlined user interface makes the form quite powerful.</p>
<p>However, it being created mostly in Flash you have every chance of making the form quite stunning when it comes to designing it. You can also create new input fields and buttons that match your website or blog theme. You can even go ahead and animate the buttons or the input fields. The entire look of the contact form is up to you.</p>
<p>The easy setup makes this form quite powerful in any website design. A PHP file is included in this download to handle the submission system which you simply upload to your server and you are ready to go.</p>
<p>I am sure that you can add validation, captcha and/or input field check to the form if you have just a little bit of flash experience along with some skills in PHP coding. Fusing the two is quite easy once you get a hang of it.</p>
<p><strong>Source:</strong> <a title="Website Link" href="http://www.flash-template-design.com/flash_php_contact_form.php" target="_blank">Flash Template Design</a></p>
<p><a title="Website Link" href="http://www.flash-template-design.com/flash_php_contact_form.php" target="_blank"></a><a title="Download Button" href="http://www.minervity.com/wp-content/plugins/download-monitor/download.php?id=5"><img class="aligncenter size-full wp-image-2999" style="margin-bottom:45px;" title="Download Button - Flash / PHP" src="http://www.minervity.com/wp-content/uploads/2009/04/download-button-transparent5.png" alt="Download Button - Flash / PHP" width="235" height="75" /></a></p></blockquote>
<h2>5. Pure AJAX Contact Form</h2>
<blockquote><p><img class="alignleft size-full wp-image-3022" style="margin-right:20px;" title="AJAX Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/ajax-contact-form.jpg" alt="AJAX Contact Form" width="276" height="595" /></p>
<p>A simple but well stylised contact form that sure will make your visitors feel welcome to contact you right away.</p>
<p>This form is based on pure AJAX code which makes it truly customizable if you are a little bit familiar with AJAX programming. Add or change any field you need changed to get it just the way you want it.</p>
<p>This form has no particular features to brag about like the more advanced forms. However, it has a nice CC button that will enable the visitor that uses the contact form to send the form submission to him or herself as well.</p>
<p>Implementing this on your site is quite easy. All you have to do after downloading this is either to copy the form code and paste it right where you want it on your site. Or, you can simple just use the original html file and all should be good to go.</p>
<p>Powerful, little hassle and professionally looking.</p>
<p><strong>Source:</strong> <a title="Website Link" href="http://mtsix.com/mtcontactform/" target="_blank">MTSix</a></p>
<p><a title="Download Button" href="http://www.minervity.com/wp-content/plugins/download-monitor/download.php?id=6"><img class="aligncenter size-full wp-image-3028" style="margin-bottom:70px;" title="Download Button - Pure AJAX Contact Form" src="http://www.minervity.com/wp-content/uploads/2009/04/download-button-transparent6.png" alt="Download Button - Pure AJAX Contact Form" width="235" height="75" /></a></p></blockquote>
<img src="http://www.minervity.com/?ak_action=api_record_view&id=2903&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.minervity.com/features/php_scripts/5-different-ways-to-create-stylish-contact-form-layouts/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>How To Create a Flash XML Slideshow Player</title>
		<link>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-slideshow-player/</link>
		<comments>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-slideshow-player/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 11:39:03 +0000</pubDate>
		<dc:creator>Richard Darell</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Movie]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Picture]]></category>
		<category><![CDATA[Player]]></category>
		<category><![CDATA[Slideshow]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.minervity.com/?p=1109</guid>
		<description><![CDATA[Introduction
In this tutorial we will be creating a Slidshow application for your site or blog. This tutorial is once again very basic and uses pretty simple ActionScripting to get things done. As usual I will ...]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-1206" style="margin-right:20px; margin-bottom:40px;" title="Article Title Image" src="http://www.minervity.com/wp-content/uploads/2009/02/article-title-image.jpg" alt="Article Title Image" width="200" height="225" />Introduction</h2>
<p>In this tutorial we will be creating a Slidshow application for your site or blog. This tutorial is once again very basic and uses pretty simple ActionScripting to get things done. As usual I will explain what the script does so you can follow what&#8217;s going on and when.</p>
<p>Necessary skills are basic and we&#8217;re going to do some ActionScripting, Masking and XML scripting which will make sure we can use this slidesho application whenever and how many time we want. This means we will load pictures and picture tag lines dynamically which enables you to always update your Slideshow with new content.</p>
<p>Software&#8217;s and Languages used:</p>
<ul>
<li>Adobe Flash</li>
<li>Adobe Photoshop</li>
<li>ActionScript</li>
<li>FTP Client</li>
</ul>
<h2>Step 1</h2>
<p>The first thing we have to do is to create a User Interface for our Slideshow Player. The interactivity is going to be a Next, Prev and a Slideshow Speed button. There are millions of ways you can design your User Interface to fit your blog or website. Your creativity is really only the limit.</p>
<p>I have created a fairly simple and straight forward User Interface. What&#8217;s important to remember here is to Layer everything so you can dis include some things when adding your background in Flash for example. You wouldn&#8217;t want to have you player showing all the buttons as it then will become kind of weird looking when you adjust the speed for example.</p>
<p>Here is my User Interface all put together:</p>
<p><img class="aligncenter size-full wp-image-1115" title="User Interface" src="http://www.minervity.com/wp-content/uploads/2009/02/slideshow-ui-complete.jpg" alt="User Interface" width="263" height="356" /></p>
<h2>Step 2</h2>
<p>Now when we have our User Interface it&#8217;s time to setup our Flash project. Open your Adobe Flash and open a new project. Make it ActionScript 2.0. After your new project has been created open the &#8220;Document Properties&#8221; window by either double clicking on the &#8220;Frame Rate&#8221; display or by pressing &#8220;<strong>Ctrl-J</strong>&#8220;.</p>
<p>With the window open add these settings (considering you have the same User Interface Properties as I am using in my User Interface. Width, Height etc&#8230;):</p>
<ul>
<li>Title: Slideshow Player</li>
<li>Width: 263px</li>
<li>Height: 356px</li>
<li>Background Color: White (#ffffff) &#8211; Considering you want the same background color.</li>
<li>Frame Rate: 25 fps (Frames per Second)</li>
</ul>
<h2>Step 3</h2>
<p>Let&#8217;s create the layers we need for this application. We&#8217;re going to be creating a pre-loader for the Slideshow. Not a pre-loader that loads all the pictures at once as this would make our player slow and frustrating before it actually begins if we were to use a vast amount of pictures to Slideshow.</p>
<p>The layers we are going to need are (from top to bottom):</p>
<ul>
<li>actions</li>
<li>buttons</li>
<li>speedcontrol</li>
<li>textfield</li>
<li>display</li>
<li>preloader</li>
<li>background</li>
</ul>
<p>If you want to add for example a title to your player you can just go ahead and add another layer. It&#8217;s really up to you what you want to add to this player.</p>
<p>In the &#8220;display&#8221; layer we are going to play around with masking to get the result we&#8217;re after when changing images. But we will get to that.</p>
<h2>Step 4</h2>
<p>Let us start adding stuff to our player by adding the background we&#8217;re going to be using. Before adding my background (User Interface) I have to take out everything that will be moving around. Would want to reveal a stuck nob while the movable object is floating around.</p>
<p>So, in Photoshop I will just de-select the layers I don&#8217;t want visible in the background of our Slideshow Player.</p>
<p>After that, let&#8217;s import our background to our project. With our &#8220;<strong>background</strong>&#8221; layer selected click &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Import</strong>&#8221; -&gt; &#8220;<strong>Import To Stage&#8230;</strong>&#8221;</p>
<p>When your graphics have been imported you might have to align them properly. Either use your &#8220;<strong>align</strong>&#8221; toolbox to your right or set X and Y in your &#8220;<strong>info</strong>&#8221; box to your right to 0 and 0. This will align your background to the upper-left corner.</p>
<p>Go ahead and lock the layer to prevent any movement.</p>
<h2>Step 5</h2>
<p>Now with out background all included. Let&#8217;s create the pre-loader for our pictures. So, create a rectangular box over the &#8220;Speed Slider Bar&#8221; with the size of Width: 250, Height: 12. Color doesn&#8217;t matter as our box will later become transparent anyways.</p>
<p>With that done we need to convert our rectangle into a video clip. With the recangle selected click &#8220;<strong>Modify&#8221;</strong> -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; Use these settings for the new movie clip:</p>
<p><img class="aligncenter size-full wp-image-1122" title="Pre-Loader Settings" src="http://www.minervity.com/wp-content/uploads/2009/02/pre-loader-settings.jpg" alt="Pre-Loader Settings" width="418" height="141" /></p>
<p>When done converting the rectangle into a movie clip make sure you set the &#8220;<strong>Instance Name</strong>&#8221; to &#8220;<strong>preloader</strong>&#8220;.</p>
<p>Double click the newly created movie to get inside the movie for us to set things up. When inside the movie create one new layer and name them (from top to bottom):</p>
<ul>
<li>preloaderbar</li>
<li>loaderbackground</li>
</ul>
<p>What we have to do now is to actually make our background transparent so it show our real background and it&#8217;s details.</p>
<p>Select the rectangle that we just created a movie clip out of (this time inside the movie). We are going to convert it into a &#8220;bitmap&#8221; so we can mess around with it&#8217;s properties a little. Click &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; Use these settings for our &#8220;bitmap&#8221;:</p>
<p><img class="aligncenter size-full wp-image-1123" title="Loader Background Settings" src="http://www.minervity.com/wp-content/uploads/2009/02/loader-background-settings.jpg" alt="Loader Background Settings" width="418" height="141" /></p>
<p>Alright, now we have a &#8220;bitmap&#8221; to play around with and will be able to set a bunch of settings if we so wanted. However, there is only one setting we really need to mess around with this time. With the &#8220;bitmap&#8221; selected you will see a bunch of properties that we can set in the lower part of your screen.</p>
<p>It&#8217;s the &#8220;<strong>Color</strong>&#8221; setting we&#8217;re going to change and in this case the &#8220;Aplha&#8221; level. So, go ahead and click the roll down menu and choose &#8220;Alpha&#8221; and set the level to &#8220;0%&#8221;. As you can see now our background layer is transparent and out of the way. Great!</p>
<p>Time to create the actual loader in itself.</p>
<p>In our &#8220;<strong>prelaoderbar</strong>&#8221; layer let&#8217;s create what&#8217;s going to be our Pre-Loader indicator bar. Create another rectangle (pick the color you want) with the exact same size: Width: 250, Height: 12 and place it exactly where the first one was placed. Should look like this:</p>
<p><img class="aligncenter size-full wp-image-1127" title="Loader Bar Positioning" src="http://www.minervity.com/wp-content/uploads/2009/02/loader-bar-positioning.jpg" alt="Loader Bar Positioning" width="418" height="141" /></p>
<p>With that done we now have to create a movie clip out of this rectangle as well. So, go ahead and click &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; and use the same settings we used last time we created our movie clip. Only this time use the title &#8220;<strong>Loader Bar Indicator</strong>&#8220;.</p>
<p>While having the newly created movie clip selected set the &#8220;Instance Name&#8221; to &#8220;<strong>preload_bar</strong>&#8220;.</p>
<p>When this is done, let&#8217;s make it a bit transparent to make sure we get that cool effect of being able to look through it to see the details on the background.</p>
<p>With the newly created movie clip selected go ahead and change the &#8220;<strong>Alpha</strong>&#8221; level again to 20%. This will make it transparent but still visible enough to be seen and show the loading progression.</p>
<p>You should now have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-1130" title="Loader Bar Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/loeader-bara-complete.jpg" alt="Loader Bar Complete" width="295" height="632" /></p>
<h2>Step 6</h2>
<p>Time to create the actual display. The pane where we are going to show our pictures. Start by creating a square box where you want your pictures to be shown in the &#8220;<strong>display</strong>&#8221; layer. My box measures: Width: 249, Height: 186. Align it to where you want it to be positioned. Here is where I positioned my picture window:</p>
<p><img class="aligncenter size-full wp-image-1132" title="Picture Window Positioning" src="http://www.minervity.com/wp-content/uploads/2009/02/picture-window-positioning.jpg" alt="Picture Window Positioning" width="274" height="367" /></p>
<p>Alright, time to convert this box into a dynamic loader by converting it into a movie clip. As usual, convert it by clicking &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; Again use the &#8220;Movie Clip&#8221; selection and set the name to &#8220;<strong>Slidehow Window</strong>&#8220;.</p>
<p>Now, set the &#8220;Instance Name&#8221; to &#8220;<strong>picture</strong>&#8220;. And after doing that, double click your movie clip and when you enter the inside of the movie clip, select that square you just created and delete it. There should only be an empty frame left in the layer bar. This will make the window non visible before there are any pictures in it. Later when we load the image it will be resizing itself.</p>
<p>In order for the pictures not to size up larger then the actual position where we want the picture to be show we are going to create a mask layer so that any excess will be cut off when this happens.</p>
<p>Now, with the &#8220;<strong>display</strong>&#8221; layer selected create another layer. Name the layer &#8220;<strong>masking</strong>&#8220;. In the masking layers first frame. Create another box exactly sized as the old one. Width:249, Height: 186.</p>
<p>After doing that, right click the &#8220;<strong>masking</strong>&#8221; layer and select &#8220;<strong>Mask</strong>&#8220;. You will now notice how your newly created box disappears. You have now created a masking for the picture. The picture will only be visible inside this box. Anything that goes outside the masking limits will become invisible. Everything will be kept nice and tidy.</p>
<p>Now we should be done setting up our picture pane and it&#8217;s time move on to the next step.</p>
<h2>Step 7</h2>
<p>In our Slideshow we would like to have some tags/info showing for each image so the viewer will know what he/she is looking at. This is easily created with a dynamic text field which we then can program to load text along with the image showing.</p>
<p>So, lets create a dynamic text field on our Slideshow. Pick the &#8220;Text&#8221; tool and create a text field where you want it positioned. My text field measured: Width: 244, Height: 98. It&#8217;s positioned here:</p>
<p><img class="aligncenter size-full wp-image-1135" title="Text Field Positioning" src="http://www.minervity.com/wp-content/uploads/2009/02/text-field-positioning.jpg" alt="Text Field Positioning" width="274" height="367" /></p>
<p>Now we need to set up our text field so that it will be dynamic and able to load text from an XML document. In the text fields &#8220;Properties&#8221; that you find in the lower part of your screen, add these settings:</p>
<ul>
<li>Change the Text Type to: <strong>Dynamic</strong></li>
<li>Instance Name: &#8220;<strong>desc_txt</strong>&#8220;</li>
<li>Font: <strong>Arial Bold</strong></li>
<li>Font Size: <strong>11</strong></li>
<li>Font Color: <strong>#777777</strong></li>
<li>Line Type: <strong>Multiline</strong></li>
<li>Align Text: <strong>Left</strong></li>
<li>Embed: <strong>Uppercase, Lowercase, Numerals, Punctuation, Basic Latin</strong></li>
</ul>
<p>Alright, our &#8220;tag line&#8221; text field is set up. We have another text field to set up as well. The text field that will display how many pictures there are in the Slideshow and what image we are currently displaying.</p>
<p>So, add another text field using these settings:</p>
<ul>
<li>Text Type: <strong>Dynamic</strong></li>
<li>Instance Name: &#8220;<strong>pos_txt</strong>&#8220;</li>
<li>Font: <strong>Arial Bold</strong></li>
<li>Font Size: <strong>12</strong></li>
<li>Font Color: <strong>#ffffff</strong></li>
<li>Line Type: <strong>Single Line</strong></li>
<li>Align: <strong>Center</strong></li>
<li>Embed: <strong>Uppercase, Lowercase, Numerals, Punctuation, Basic Latin</strong></li>
</ul>
<p>I have chosen white just because it&#8217;s the least probable color to cover the most part of the image you are going to show. But font color is entirely up to your taste so go ahead and change it if you feel you want another one to fit your website/blog theme.</p>
<p>Here is the finished positioning and layout of the text fields:</p>
<p><img class="aligncenter size-full wp-image-1139" title="Text Field Positioning - Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/text-field-positioning-complete.jpg" alt="Text Field Positioning - Complete" width="274" height="367" /></p>
<p>Now our text fields are set up and it&#8217;s time to move on to the next step yet again.</p>
<h2>Step 8</h2>
<p>Time to create the Slideshow Speed adjuster. We&#8217;re going to make a little drag box that will adjust the speed of the Slideshow and how often it changes images.</p>
<p>So, go ahead and create a rectangle over the loaderbar in the &#8220;<strong>speedcontrol</strong>&#8221; layer. Size it: Width: 250, Height: 12.</p>
<p>After doing that, we once again must create a movie clip out of our rectangle to make it interactive. Click &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; Use the same settings as usual but name it &#8220;<strong>Speed Control</strong>&#8220;.</p>
<p>Set the &#8220;<strong>Instance Name</strong>&#8221; to &#8220;<strong>speedbar</strong>&#8220;.</p>
<p>Double click the newly created movie clip to get inside it. In there, create another movie clip out of the rectangle again. Same procedure but name it &#8220;<strong>Speed Bar Background</strong>&#8220;. Also set the &#8220;<strong>Instance Name</strong>&#8221; to &#8220;<strong>speedBG</strong>&#8220;.</p>
<p>With then newly created movie clip (&#8220;Speed Bar Background&#8221; selected. Set the &#8220;Alpha&#8221; level to 0% to make it transparent.</p>
<p>We now need to add our drag box. Import it by clicking &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Import</strong>&#8221; -&gt; &#8220;<strong>Import To Stage&#8230;</strong>&#8221; to the same layer and frame as your newly created movie clip. Position it all the way right in the Speed Bar.</p>
<p>The &#8220;Drag Box&#8221; is now a &#8220;graphic&#8221; entity and we need to convert it into a movie clip also to be able to play around with it. Convert it using the same settings as usual but name it: &#8220;<strong>Dragger</strong>&#8220;. Also set the &#8220;Instance Name&#8221; to &#8220;<strong>dragger</strong>&#8220;.</p>
<p>With everything set up properly you should now have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-1142" title="Drag Box Setup Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/drag-box-complete.jpg" alt="Drag Box Setup Complete" width="274" height="367" /></p>
<h2>Step 9</h2>
<p>Alright, so all our interface functions is set up graphically. It&#8217;s time for us to add some interactivity to the things. Let&#8217;s add our buttons to the user interface.</p>
<p>As you can see our background is already showing our buttons. Well, this is no problem, just makes it easier for us to align and position our buttons. They will never be moved out of their position so the background is never going to be seen anyways.</p>
<p>Now, go ahead and add your buttons to the user Interface. Position them where they are supposed to be.</p>
<p>After you have positioned your buttons, go ahead and convert them to buttons. Do so by clicking &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; name them &#8220;<strong>Prev Btn</strong>&#8221; and &#8220;<strong>Next Btn</strong>&#8221; and choose &#8220;<strong>Button</strong>&#8220;. Set their &#8220;<strong>Instance Name</strong>&#8221; to &#8220;<strong>previous_btn</strong>&#8221; and &#8220;<strong>next_btn</strong>&#8220;.</p>
<p>Now we have some working buttons as well. You can go ahead and add different stage images to the buttons if you like. It&#8217;s all up to you what you want your buttons to do when &#8220;Hovering&#8221;, &#8220;Clicked&#8221; and so on.</p>
<h2>Step 10</h2>
<p>Now we need to add some functionality to our User Interface. Time to for the core. The ActionScript that actually will make things move. Look at it as if we&#8217;re bringing life to our Slideshow with Actionscript.</p>
<blockquote><p><span style="color: #ff0000;">delay = 10000;</span></p></blockquote>
<blockquote><p>Sets the speed of the Slideshow. The 10000 indicates the time between each image. This can later be adjusted by our Speed Control drag box.</p></blockquote>
<blockquote><p><span style="color: #ff0000;">function loadXML(loaded) {<br />
if (loaded) {<br />
xmlNode = this.firstChild;<br />
image = [];<br />
description = [];<br />
total = xmlNode.childNodes.length;<br />
for (i=0; i&lt;total; i++) {<br />
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;<br />
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;<br />
}<br />
firstImage();<br />
} else {<br />
content = &#8220;file not loaded!&#8221;;<br />
}<br />
}</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 1 -Opens up a function that will load our XML file and store the contents.</span><br />
<span style="color: #000000;">Line 2 &#8211; Checks if any XML file has already been loaded.</span><br />
<span style="color: #000000;">Line 3 &#8211; Sets up our variable parent.</span><br />
<span style="color: #000000;">Line 4 &#8211; Creates the child variable &#8220;image&#8221; to xmlNode.</span><br />
<span style="color: #000000;">Line 5 &#8211; Creates the child variable &#8220;description&#8221; to xmlNode.</span><br />
<span style="color: #000000;">Line 6 &#8211; Creates a variable that will hold the number of total images.</span><br />
<span style="color: #000000;">Line 7 &#8211; Calculates the total number of images in the Slideshow.</span><br />
<span style="color: #000000;">Line 8 &#8211; Holds the current image that will be displayed. In this case the first one.</span><br />
<span style="color: #000000;">Line 9 &#8211; Holds the current description that will be displayed. In this case the first one.</span><br />
<span style="color: #000000;">Line 10 &#8211; Ends the calculation process.</span><br />
<span style="color: #000000;">Line 11 &#8211; Directs the Script to the &#8220;firstImage&#8221; function.</span><br />
<span style="color: #000000;">Line 12 &#8211; If no content is found, then this&#8230;</span><br />
<span style="color: #000000;">Line 13 &#8211; Content not loaded.</span><br />
<span style="color: #000000;">Line 14 &#8211; Ends the &#8220;else&#8221; process.</span><br />
<span style="color: #000000;">Line 15 &#8211; Ends the if loaded process.</span></p></blockquote>
<blockquote><p><span style="color: #000000;"><span style="color: #ff0000;">xmlData = new XML();<br />
xmlData.ignoreWhite = true;<br />
xmlData.onLoad = loadXML;<br />
xmlData.load(&#8220;images.xml&#8221;);<br />
listen = new Object();<br />
listen.onKeyDown = function() {<br />
if (Key.getCode() == Key.LEFT) {<br />
prevImage();<br />
} else if (Key.getCode() == Key.RIGHT) {<br />
nextImage();<br />
}<br />
};</span><br />
</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 16 &#8211; Creates a variable to hold the XML file content.</span><br />
<span style="color: #000000;">Line 17 &#8211; Ignore any line spacing that might occur in the file.</span><br />
<span style="color: #000000;">Line 18 &#8211; Sets up the load session.</span><br />
<span style="color: #000000;">Line 19 &#8211; Loads the XML file.</span> (Here it is important to add the EXACT pathway to your xml file on the server. Meaning for example &#8220;http://www.sitename.com/slideshow/images.xml&#8221;)<br />
<span style="color: #000000;">Line 20 &#8211; Opens up button functionality. Listens for interactions.</span><br />
<span style="color: #000000;">Line 21 &#8211; Opens up a function that listens for Key strokes.</span><br />
<span style="color: #000000;">Line 22 &#8211; If &#8220;left&#8221; key is pressed.</span><br />
<span style="color: #000000;">Line 23 &#8211; Go to prevImage function and execute it.</span><br />
<span style="color: #000000;">Line 24 &#8211; If &#8220;right&#8221; key is pressed.</span><br />
<span style="color: #000000;">Line 25 &#8211; Go to nextImage function and execute it.</span><br />
<span style="color: #000000;">Line 26 &#8211; Close &#8220;if&#8221; process.</span><br />
<span style="color: #000000;">Line 27 &#8211; Close loadXML function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">previous_btn.onRelease = function() {<br />
clearInterval(myInterval);<br />
if (p == 0) {<br />
lastImage()<br />
} else {<br />
prevImage();<br />
}<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 28 &#8211; Opens up &#8220;previous_btn&#8221; button onRelease function.</span><br />
<span style="color: #000000;">Line 29 &#8211; Resets the interval.</span><br />
<span style="color: #000000;">Line 30 &#8211; If we&#8217;re at the first image&#8230;</span><br />
<span style="color: #000000;">Line 31 &#8211; Load the last image in the list.</span><br />
<span style="color: #000000;">Line 32 &#8211; If not&#8230;then&#8230;</span><br />
<span style="color: #000000;">Line 33 &#8211; Go to the previous image in the list.</span><br />
<span style="color: #000000;">Line 34 &#8211; Close the else process.</span><br />
<span style="color: #000000;">Line 35 &#8211; Close the &#8220;previous_btn&#8221; onRelease function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">next_btn.onRelease = function() {<br />
clearInterval(myInterval);<br />
if (p == (total-1)) {<br />
p = 0;<br />
firstImage();<br />
} else {<br />
nextImage();<br />
}<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 36 &#8211; Opens up &#8220;next_btn&#8221; onRelease function.</span><br />
<span style="color: #000000;">Line 37 &#8211; Resets the interval.</span><br />
<span style="color: #000000;">Line 38 &#8211; If number is less or equal to the total amount of images.</span><br />
<span style="color: #000000;">Line 39 &#8211; Resets the P variable to zero.</span><br />
<span style="color: #000000;">Line 40 &#8211; Go to the firstImage function and execute it.</span><br />
<span style="color: #000000;">Line 41 &#8211; If not&#8230;then&#8230;</span><br />
<span style="color: #000000;">Line 42 &#8211; Go to the nextImage function and execute it.</span><br />
<span style="color: #000000;">Line 43 &#8211; Close the &#8220;else&#8221; process.</span><br />
<span style="color: #000000;">Line 44 &#8211; Close the &#8220;next_btn&#8221; onRelease function.</span></p></blockquote>
<blockquote><p><span style="color: #000000;"><span style="color: #ff0000;">p = 0;<br />
this.onEnterFrame = function() {<br />
filesize = picture.getBytesTotal();<br />
loaded = picture.getBytesLoaded();<br />
preloader._visible = true;<br />
if (loaded != filesize) {<br />
preloader.preload_bar._xscale = 100*loaded/filesize;<br />
} else {<br />
preloader._visible = false;<br />
if (picture._alpha&lt;100) {<br />
picture._alpha += 10;<br />
}<br />
}<br />
};</span><br />
</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 45 &#8211; Resets the image counter to zero.</span><br />
<span style="color: #000000;">Line 46 &#8211; Opens up a onEnterFrame function.</span><br />
<span style="color: #000000;">Line 47 &#8211; Creates a variable (filesize) which will store the total amount of Bytes for an image.</span><br />
<span style="color: #000000;">Line 48 &#8211; Creates a variable (loaded) that will store the current amount of bytes loaded.</span><br />
<span style="color: #000000;">Line 49 &#8211; Make the &#8220;preloader&#8221; visible.</span><br />
<span style="color: #000000;">Line 50 &#8211; If the current amount of bytes loaded is equal to the total amount of bytes then&#8230;</span><br />
<span style="color: #000000;">Line 51 &#8211; Calculate the actual width of the loaderbar progress.</span><br />
<span style="color: #000000;">Line 52 &#8211; If not&#8230;then&#8230;</span><br />
<span style="color: #000000;">Line 53 &#8211; Make the &#8220;preloader&#8221; invisible.</span><br />
<span style="color: #000000;">Line 54 &#8211; If &#8220;picture&#8221;&#8217;s Alpha level is less then 100 then&#8230;</span><br />
<span style="color: #000000;">Line 55 &#8211; Add another 10 to the pictures Alpha level.</span><br />
<span style="color: #000000;">Line 56 &#8211; Close the &#8220;else&#8221; process.</span><br />
<span style="color: #000000;">Line 57 &#8211; Close the &#8220;if loaded&#8221; process.</span><br />
<span style="color: #000000;">Line 58 &#8211; Close the onEnterFrame function.</span></p></blockquote>
<blockquote><p><span style="color: #000000;"><span style="color: #ff0000;">function nextImage() {<br />
if (p&lt;(total-1)) {<br />
p++;<br />
if (loaded == filesize) {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[p], 1);<br />
desc_txt.text = description[p];<br />
picture_num();<br />
slideshow();<br />
}<br />
}<br />
};</span><br />
</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 59 &#8211; Opens up nextImage function.</span><br />
<span style="color: #000000;">Line 60 &#8211; If we haven&#8217;t yet come to the end of the list of images.</span><br />
<span style="color: #000000;">Line 61 &#8211; Add one to the image counter.</span><br />
<span style="color: #000000;">Line 62 &#8211; If the loaded amount of bytes is the same as the total amount of bytes then&#8230;</span><br />
<span style="color: #000000;">Line 63 &#8211; Set pictures &#8220;Alpha&#8221; level to 0.</span><br />
<span style="color: #000000;">Line 64 &#8211; Load the current numbered image.</span><br />
<span style="color: #000000;">Line 65 &#8211; Add the text content in the XML file to the &#8220;desc_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 66 &#8211; Go to then &#8220;picture_num&#8221; function.</span><br />
<span style="color: #000000;">Line 67 &#8211; Go to the &#8220;slideshow&#8221; function.</span><br />
<span style="color: #000000;">Line 68 &#8211; Close the &#8220;if loaded&#8221; process.</span><br />
<span style="color: #000000;">Line 69 &#8211; Close the &#8220;if total&#8221; process.</span><br />
<span style="color: #000000;">Line 70 &#8211; Close the &#8220;nextImage&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">function prevImage() {<br />
if (p&gt;0){<br />
p&#8211;;<br />
picture._alpha = 0;<br />
picture.loadMovie(image[p], 1);<br />
desc_txt.text = description[p];<br />
picture_num();<br />
slideshow();<br />
}<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 71 &#8211; Opens up &#8220;prevImage&#8221; function.</span><br />
<span style="color: #000000;">Line 72 &#8211; If Image is not the first then&#8230;</span><br />
<span style="color: #000000;">Line 73 &#8211; Subtract one from the counter.</span><br />
<span style="color: #000000;">Line 74 &#8211; Set the pictures &#8220;Alpha&#8221; level to 0.</span><br />
<span style="color: #000000;">Line 75 &#8211; Load the current numbered movie.</span><br />
<span style="color: #000000;">Line 76 &#8211; Put the current numbered text into the &#8220;desc_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 77 &#8211; Go to the &#8220;picture_num&#8221; function.</span><br />
<span style="color: #000000;">Line 78 &#8211; Go to the &#8220;slideshow&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">function firstImage() {<br />
if (loaded == filesize) {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[0], 1);<br />
desc_txt.text = description[0];<br />
picture_num();<br />
slideshow();<br />
}<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 79 &#8211; Opens up the &#8220;firstImage&#8221; function.</span><br />
<span style="color: #000000;">Line 80 &#8211; If the amount of bytes loaded is equal to the total amount of bytes then&#8230;</span><br />
<span style="color: #000000;">Line 81 &#8211; Set the image &#8220;Alpha&#8221; level to zero.</span><br />
<span style="color: #000000;">Line 82 &#8211; Load the current numbered image.</span><br />
<span style="color: #000000;">Line 83 &#8211; Put the current numbered text into the &#8220;sesc_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 84 &#8211; Go to the &#8220;picture_num&#8221; function.</span><br />
<span style="color: #000000;">Line 85 &#8211; Go to the &#8220;slideshow&#8221; function.</span><br />
<span style="color: #000000;">Line 86 &#8211; Close the &#8220;if loaded&#8221; function.</span><br />
<span style="color: #000000;">Line 87 &#8211; Close the &#8220;firstImage&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">function lastImage() {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[total-1], 1);<br />
desc_txt.text = description[total-1];<br />
current_pos = total;<br />
pos_txt.text = current_pos+&#8221; / &#8220;+total;<br />
p = total-1;<br />
slideshow();<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 88 &#8211; Opens up the &#8220;lastImage&#8221; function.</span><br />
<span style="color: #000000;">Line 89 &#8211; Set the image &#8220;Alpha&#8221; level to zero.</span><br />
<span style="color: #000000;">Line 90 &#8211; Load the current numbered image.</span><br />
<span style="color: #000000;">Line 91 &#8211; Put the current numbered text into the &#8220;desc_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 92 &#8211; Put the current position in the slideshow count into the &#8220;current_pos&#8221; variable.</span><br />
<span style="color: #000000;">Line 93 &#8211; Put the current position and the total number of images into the &#8220;pos_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 94 &#8211; Subtract one from the current position.</span><br />
<span style="color: #000000;">Line 95 &#8211; Go to the &#8220;slideshow&#8221; function.</span><br />
<span style="color: #000000;">Line 96 &#8211; Close the &#8220;lastImage&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">function picture_num() {<br />
current_pos = p+1;<br />
pos_txt.text = current_pos+&#8221; / &#8220;+total;<br />
};</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 97 &#8211; Opens up the &#8220;picture_num&#8221; function.</span><br />
<span style="color: #000000;">Line 98 &#8211; Adds the current position+1 to the &#8220;current_pos&#8221; variable.</span><br />
<span style="color: #000000;">Line 99 &#8211; Puts the current position and the total amount of images in the &#8220;pos_txt&#8221; label.</span><br />
<span style="color: #000000;">Line 100 &#8211; Close the &#8220;picture_num&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">function slideshow() {<br />
myInterval = setInterval(pause_slideshow, delay);<br />
function pause_slideshow() {<br />
clearInterval(myInterval);<br />
if (p == (total-1)) {<br />
p = 0;<br />
firstImage();<br />
} else {<br />
nextImage();<br />
}<br />
}<br />
}</span></p></blockquote>
<blockquote><p><span style="color: #000000;">Line 101 &#8211; Open up the &#8220;slideshow&#8221; function.</span><br />
<span style="color: #000000;">Line 102 &#8211; Pause the Slideshow with the amount given in &#8220;delay&#8221; variable.</span><br />
<span style="color: #000000;">Line 103 &#8211; Opens up the &#8220;pause_slideshow&#8221; function.</span><br />
<span style="color: #000000;">Line 104 &#8211; Resets the interval variabel.</span><br />
<span style="color: #000000;">Line 105 &#8211; If we have reached to the end of the list of images then&#8230;</span><br />
<span style="color: #000000;">Line 106 &#8211; Reset the position counter to zero (start).</span><br />
<span style="color: #000000;">Line 107 &#8211; Go to the &#8220;firstImage&#8221; function and execute it.</span><br />
<span style="color: #000000;">Line 108 &#8211; If not&#8230;then&#8230;</span><br />
<span style="color: #000000;">Line 109 &#8211; Go to the &#8220;nextImage&#8221; function and execute it.</span><br />
<span style="color: #000000;">Line 110 &#8211; Close the &#8220;else&#8221; process.</span><br />
<span style="color: #000000;">Line 111 &#8211; Close the &#8220;if&#8221; process.</span><br />
<span style="color: #000000;">Line 112 &#8211; Close the &#8220;slideshow&#8221; function.</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;">this.speedbar.dragger.onPress = function() {<br />
startDrag(this, true, 1, this._y, this._parent.speedBG._width-20, this._y);<br />
this.onEnterFrame = function() {<br />
delay = (10000/100)*((this._x/(this._parent.speedBG._width-20))*100);<br />
if (delay &lt; 1000) { delay = 1000;}<br />
};<br />
};</span></p></blockquote>
<blockquote><p>Line 113 &#8211; Opens up the &#8220;dragger&#8221; onPress function.<br />
Line 114 &#8211; If &#8220;dragger&#8221; is draged the result is adjusted here.<br />
Line 115 &#8211; Open up the &#8220;dragger&#8221; onEnterFrame function.<br />
Line 116 &#8211; Calculates the amount of &#8220;pause&#8221; the Slideshow should have in between each image.<br />
Line 117 &#8211; If delay dragger amount is less then 1000 then the &#8220;pause&#8221; stays at 1000 (1 sec).<br />
Line 118 &#8211; Close the &#8220;dragger&#8221; onEnterFrame function.<br />
Line 119 &#8211; Close the &#8220;dragger&#8221; onPress function.</p></blockquote>
<blockquote><p><span style="color: #ff0000;">this.speedbar.dragger.onRelease = function() {<br />
delete this.onEnterFrame;<br />
stopDrag();<br />
};</span></p></blockquote>
<blockquote><p>Line 120 &#8211; Opens up the &#8220;dragger&#8221; onRelease function.<br />
Line 121 &#8211; Deletes the onEnterFrame tag validator.<br />
Line 122 &#8211; Indicates the user stopped dragging.<br />
Line 123 &#8211; Close the &#8220;dragger&#8221; onRelease function.</p></blockquote>
<blockquote><p><span style="color: #ff0000;">this.speedbar.dragger.onReleaseOutside = function() {<br />
stopDrag();<br />
};</span></p></blockquote>
<blockquote><p>Line 124 &#8211; Opens up the &#8220;dragger&#8221; onReleaseOutside function.<br />
Line 125 &#8211; Indicates the user stopped dragging.<br />
Line 126 &#8211; Close the &#8220;dragger&#8221; onReleaseOutside function.</p></blockquote>
<p><span style="color: #000000;">Well, that was all as far as ActionScripting. Not too much was it. Well, I can admit it was a bit much but it&#8217;s usually repetitive stuff and besides. Repetition is great for learning. Now when I have explained the whole script and all is set up it&#8217;s time to save our project and start with the content of the actual Slideshow.</span></p>
<p><span style="color: #000000;">But first, here is the entire ActionScript for an easy copy and paste solution.</span></p>
<h2><span style="color: #000000;">Finished Code<br />
</span></h2>
<blockquote><p><span style="color: #ff0000;">delay = 10000;</span></p>
<p><span style="color: #ff0000;">function loadXML(loaded) {<br />
if (loaded) {<br />
xmlNode = this.firstChild;<br />
image = [];<br />
description = [];<br />
total = xmlNode.childNodes.length;<br />
for (i=0; i&lt;total; i++) {<br />
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;<br />
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;<br />
}<br />
firstImage();<br />
} else {<br />
content = &#8220;file not loaded!&#8221;;<br />
};<br />
};</span></p>
<p><span style="color: #000000;"><span style="color: #ff0000;">xmlData = new XML();<br />
xmlData.ignoreWhite = true;<br />
xmlData.onLoad = loadXML;<br />
xmlData.load(&#8220;images.xml&#8221;);<br />
listen = new Object();<br />
listen.onKeyDown = function() {<br />
if (Key.getCode() == Key.LEFT) {<br />
prevImage();<br />
} else if (Key.getCode() == Key.RIGHT) {<br />
nextImage();<br />
};<br />
};</span></span></p>
<p><span style="color: #ff0000;">previous_btn.onRelease = function() {<br />
clearInterval(myInterval);<br />
if (p == 0) {<br />
lastImage()<br />
} else {<br />
prevImage();<br />
};<br />
};</span></p>
<p><span style="color: #ff0000;">next_btn.onRelease = function() {<br />
clearInterval(myInterval);<br />
if (p == (total-1)) {<br />
p = 0;<br />
firstImage();<br />
} else {<br />
nextImage();<br />
};<br />
};</span></p>
<p><span style="color: #000000;"><span style="color: #ff0000;">p = 0;<br />
this.onEnterFrame = function() {<br />
filesize = picture.getBytesTotal();<br />
loaded = picture.getBytesLoaded();<br />
preloader._visible = true;<br />
if (loaded != filesize) {<br />
preloader.preload_bar._xscale = 100*loaded/filesize;<br />
} else {<br />
preloader._visible = false;<br />
if (picture._alpha&lt;100) {<br />
picture._alpha += 10;<br />
};<br />
};<br />
};</span></span></p>
<p><span style="color: #000000;"><span style="color: #ff0000;">function nextImage() {<br />
if (p&lt;(total-1)) {<br />
p++;<br />
if (loaded == filesize) {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[p], 1);<br />
desc_txt.text = description[p];<br />
picture_num();<br />
slideshow();<br />
};<br />
};<br />
};</span></span></p>
<p><span style="color: #ff0000;">function prevImage() {<br />
if (p&gt;0){<br />
p&#8211;;<br />
picture._alpha = 0;<br />
picture.loadMovie(image[p], 1);<br />
desc_txt.text = description[p];<br />
picture_num();<br />
slideshow();<br />
};<br />
};</span></p>
<p><span style="color: #ff0000;">function firstImage() {<br />
if (loaded == filesize) {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[0], 1);<br />
desc_txt.text = description[0];<br />
picture_num();<br />
slideshow();<br />
};<br />
};</span></p>
<p><span style="color: #ff0000;">function lastImage() {<br />
picture._alpha = 0;<br />
picture.loadMovie(image[total-1], 1);<br />
desc_txt.text = description[total-1];<br />
current_pos = total;<br />
pos_txt.text = current_pos+&#8221; / &#8220;+total;<br />
p = total-1;<br />
slideshow();<br />
};</span></p>
<p><span style="color: #ff0000;">function picture_num() {<br />
current_pos = p+1;<br />
pos_txt.text = current_pos+&#8221; / &#8220;+total;<br />
};</span></p>
<p><span style="color: #ff0000;">function slideshow() {<br />
myInterval = setInterval(pause_slideshow, delay);<br />
function pause_slideshow() {<br />
clearInterval(myInterval);<br />
if (p == (total-1)) {<br />
p = 0;<br />
firstImage();<br />
} else {<br />
nextImage();<br />
};<br />
};<br />
};</span></p>
<p><span style="color: #ff0000;">this.speedbar.dragger.onPress = function() {<br />
startDrag(this, true, 1, this._y, this._parent.speedBG._width-20, this._y);<br />
this.onEnterFrame = function() {<br />
delay = (10000/100)*((this._x/(this._parent.speedBG._width-20))*100);<br />
if (delay &lt; 1000) { delay = 1000;}<br />
};<br />
};</span></p>
<p><span style="color: #ff0000;">this.speedbar.dragger.onRelease = function() {<br />
delete this.onEnterFrame;<br />
stopDrag();<br />
};</span></p>
<p><span style="color: #ff0000;">this.speedbar.dragger.onReleaseOutside = function() {<br />
stopDrag();<br />
};</span></p></blockquote>
<h2><span style="color: #ff0000;"><span style="color: #000000;">Step 11</span></span></h2>
<p><span style="color: #ff0000;"><span style="color: #000000;">With all that code created and our Slideshow Player all setup we are now ready to create the image list with the including tag lines. This is the part that is fun as you can just go ahead and add as many images as you want. The player will keep track of everything for you when you enter everything accordingly.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">So, open your favorite word processor (I use Notes on Windows) and type this.</span></span></p>
<blockquote><p><span style="color: #ff0000;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243; standalone=&#8221;yes&#8221;?&gt;<br />
&lt;images&gt;<br />
&lt;pic&gt;<br />
&lt;image&gt;<span style="color: #0000ff;">/Images/Image &#8211; 1.gif</span>&lt;/image&gt;<br />
&lt;caption&gt;<span style="color: #0000ff;">Me at the amusementpark with my daughter.</span>&lt;/caption&gt;<br />
&lt;/pic&gt;<br />
&lt;pic&gt;<br />
&lt;image&gt;<span style="color: #0000ff;">/Images/Image &#8211; 2.gif</span>&lt;/image&gt;<br />
&lt;caption&gt;<span style="color: #0000ff;">My daughter and me on our way to Los Angeles.</span>&lt;/caption&gt;<br />
&lt;/pic&gt;<br />
&lt;pic&gt;<br />
&lt;image&gt;<span style="color: #0000ff;">/Images/Image &#8211; 3.gif</span>&lt;/image&gt;<br />
&lt;caption&gt;<span style="color: #0000ff;">On our way to Santa Monica beach.</span>&lt;/caption&gt;<br />
&lt;/pic&gt;<br />
&lt;/images&gt;</span></p></blockquote>
<blockquote><p><span style="color: #ff0000;"><span style="color: #000000;">Line 1 &#8211; Tells the computer that this is an XML document and should be executed as such.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 2 &#8211; Tells our Slideshow Player that our image list starts here.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 3 &#8211; Tells our Slideshow Player that this is an image.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 4 &#8211; Tells our Slideshow Player that this is the tag line to the above image.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 5 &#8211; Tells our Slideshow Player this is the end of information for our image.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 6 to Line 14 &#8211; Repeating the above steps.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Line 15 &#8211; Tells our Slideshow Player that this is the end of the image list.</span></span></p></blockquote>
<p><span style="color: #ff0000;"><span style="color: #000000;">As you can see, our image list is really simple and powerful. You can actually go ahead and more information tags to the Player with a little bit of easy coding. The mind is the limit.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">When you create your XML document you will only change the &#8220;blue&#8221; text to what and where your images are located. I am using a folder where the Slideshow Player is located that holds my images for better and cleaner server structure. If you want to add more images, just upload them to the &#8220;Images&#8221; folder (in my case) and add new picture tags to the XML document and you&#8217;re good to go. It&#8217;s as easy as that.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Now when our XML Slideshow Image list is all completed, go ahead and save it in the same directory as your Slideshow Player and name the file &#8220;images.xml&#8221;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Don&#8217;t forget to put your images in a folder located in the same directory as you Slideshow Player to. All this will be uploaded to our server after we have saved our project and published it. Which we&#8217;re going to do in the next step.</span></span></p>
<h2><span style="color: #ff0000;"><span style="color: #000000;">Step 12</span></span></h2>
<p><span style="color: #ff0000;"><span style="color: #000000;">Alright, time to save our Flash project and publish it. Click &#8220;<strong>File&#8221;</strong> -&gt; &#8220;<strong>Save As&#8230;</strong>&#8221; and name your project &#8220;<strong>Slideshow Player</strong>&#8220;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">When we&#8217;re done doing this. Let&#8217;s hook up the &#8220;Publish Settings&#8221;. Open your publish settings by either &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Publish Settings&#8230;</strong>&#8221; or press &#8220;<strong>Ctrl+Shift+F12</strong>&#8220;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">What we need to do is to make sure we maintain the very best quality in our JPEG images when loading them dynamically into our Slideshow Player. So, in the &#8220;<strong>Flash</strong>&#8221; tab set the &#8220;<strong>JPEG Quality</strong>&#8221; to <strong>100%</strong>.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">Now click the &#8220;HTML&#8221; tab and change the &#8220;<strong>Quality</strong>&#8221; to &#8220;<strong>Best</strong>&#8220;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">That should be about  it for our publish settings. Now press &#8220;<strong>OK</strong>&#8220;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">To &#8220;Publish&#8221; our flash movie application either click &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Publish</strong>&#8221; or press &#8220;<strong>Shift+F12</strong>&#8220;.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">We have now hopefully successfully published our finished Slideshow Player and are ready to implement it on our website or blog.</span></span></p>
<h2><span style="color: #ff0000;"><span style="color: #000000;">Step 13</span></span></h2>
<p><span style="color: #ff0000;"><span style="color: #000000;">To upload everything and to add it to your website or blog there are just a few more steps until it&#8217;s all done. Use your favorite FTP client and upload everything to your server. Make sure you remember the file path for your Slideshow Player.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">After doing this you can incorporate your Flash Slideshow Player by adding this anywhere in your website or blog.</span></span></p>
<blockquote><p><span style="color: #ff0000;">&lt;object classid=&#8221;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0&#8243; width=&#8221;263&#8243; height=&#8221;356&#8243; id=&#8221;Slideshow Player&#8221; align=&#8221;middle&#8221;&gt;<br />
&lt;param name=&#8221;allowScriptAccess&#8221; value=&#8221;sameDomain&#8221; /&gt;<br />
&lt;param name=&#8221;allowFullScreen&#8221; value=&#8221;false&#8221; /&gt;<br />
&lt;param name=&#8221;movie&#8221; value=&#8221;/Slideshow App/Slideshow Player.swf&#8221; /&gt;</span><br />
<span style="color: #ff0000;">&lt;param name=&#8221;quality&#8221; value=&#8221;best&#8221; /&gt;</span><br />
<span style="color: #ff0000;">&lt;param name=&#8221;bgcolor&#8221; value=&#8221;#ffffff&#8221; /&gt;</span><br />
<span style="color: #ff0000;">&lt;embed src=&#8221;/Slideshow App/Slideshow Player.swf&#8221; quality=&#8221;best&#8221; bgcolor=&#8221;#ffffff&#8221; width=&#8221;263&#8243; height=&#8221;356&#8243; name=&#8221;Slideshow Player&#8221; align=&#8221;middle&#8221; allowScriptAccess=&#8221;sameDomain&#8221; allowFullScreen=&#8221;false&#8221; type=&#8221;application/x-shockwave-flash&#8221; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; /&gt;<br />
&lt;/object&gt;</span></p></blockquote>
<p><span style="color: #ff0000;"><span style="color: #000000;">This script adds your flash application to your site. As you can see, I decided to put my Slideshow Player Application in a folder&#8230;and that&#8217;s really all there is to it. Underneath here you can find an example of the finished Slideshow Player Application.</span></span></p>
<h2><span style="color: #ff0000;"><span style="color: #000000;">Finished Example</span></span></h2>
<p style="padding-left: 150px;">
<p style="padding-left: 150px;"><object width="263" height="356" data="/slideshow app/Slideshow Player.swf" type="application/x-shockwave-flash"><param name="name" value="Slideshow Player" /><param name="bgcolor" value="#ffffff" /><param name="align" value="middle" /><param name="src" value="/slideshow app/Slideshow Player.swf" /><param name="allowfullscreen" value="false" /><param name="quality" value="best" /></object></p>
<p style="padding-left: 150px;">
<h2>Round Up</h2>
<p>As you can see I switched some colors to make it work better with the example images. Also, go ahead and change what you feel fits better for your images and site or blog. It&#8217;s entirely up to you.</p>
<p>Well, that just about sums it all up. We now have a working slideshow application and we can now go ahead and just show our visitors our images with complimentary captions.</p>
<p>I have really enjoyed making this tutorial and I hope you have enjoyed trying it out as well. When it comes to coding it usually is a lot easier than it actually looks at the beginning. Code is never complex unless the viewer is looking at it with fatigued eyes.</p>
<p>Don&#8217;t forget that there are plenty of other tutorials on this site that will enhance the feel of your website for your every visitor. Everything from <a title="Tutorial Link" href="http://www.minervity.com/?p=803">Count-Up&#8217;s</a> and <a title="Tutorial Link" href="http://www.minervity.com/?p=715">Live Visitor Counter&#8217;s</a> to Expansive <a title="Tutorial Link" href="http://www.minervity.com/?p=844">XML Music Player&#8217;s</a>.</p>
<p>If you have any additional question please don’t hesitate to ask. I am now taking a short coffee break before I start on my next tutorial.</p>
<p>Also, don&#8217;t forget to subscribe to the RSS Feed. You can subscribe to it right here: <a title="RSS Feed Link" href="http://feedproxy.google.com/Minervity" target="_blank">Minervity RSS Feed</a></p>
<p>Thank You!</p>
<img src="http://www.minervity.com/?ak_action=api_record_view&id=1109&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-slideshow-player/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>How To Create a Flash XML Playlist Music Player</title>
		<link>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-playlist-music-player/</link>
		<comments>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-playlist-music-player/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 12:08:19 +0000</pubDate>
		<dc:creator>Richard Darell</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript 2.0]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[How To Create]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Mp3]]></category>
		<category><![CDATA[Music Player]]></category>
		<category><![CDATA[Play List]]></category>
		<category><![CDATA[Playlist]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.minervity.com/?p=844</guid>
		<description><![CDATA[Introduction
I have gotten quite a lot of requests on different tutorials that my visitors would like to see on the site and it&#8217;s really exciting. I just wish I had the time to keep up ...]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-946" style="margin-right:10px" title="Article Headline Image" src="http://www.minervity.com/wp-content/uploads/2009/02/article-headline-picture.jpg" alt="Article Headline Image" width="200" height="225" />Introduction</h2>
<p>I have gotten quite a lot of requests on different tutorials that my visitors would like to see on the site and it&#8217;s really exciting. I just wish I had the time to keep up with you and give you all what you want. But hang in there, I will get to &#8220;that&#8221; exact tutorial you&#8217;re waiting for. I just have to take them one at a time.</p>
<p>This tutorial is a bit more complex than the other ones you can find on this site. Not necessarily harder, just a bit more code to pull it off.</p>
<p>It will cover all the steps necessary to get a working Flash XML MP3 Player for your site or blog. Necessary skills are once again basic. Software&#8217;s used are: Adobe Flash, Photoshop and a simple word processor of your choice for setting up your play list. I am using &#8220;Notes&#8221; on windows just to simplify. Also some knowledge on how to use a ftp client to upload your player and music to your server is needed.</p>
<p><span style="color: #ff6600;"><span style="color: #ff0000;"><strong>PS:</strong></span> <span style="color: #000000;">You can find a working example of the player at the bottom of this tutorial. Enjoy!</span></span></p>
<h2>Step 1</h2>
<p>As usual we need some graphics that will make up our player user interface. There are a million ways you can design your player and only your creativity is the limit. I have decided to take a somewhat classic way of designing my UI for this tutorial player.</p>
<p>What you should remember is to make several files. A file of each the buttons in their different states (i.e Hover, Press etc.) How many states you want your buttons to have is entirely up to you.</p>
<p>The functions this player will have is:</p>
<ul>
<li>Play Button</li>
<li>Stop Button</li>
<li>Previous Song Button</li>
<li>Next Song Button</li>
<li>Volume Slider</li>
<li>Loader Bar</li>
<li>Information Window &#8211; Song Title, Artist Name &amp; Time</li>
</ul>
<p>As you can see this player has all the necessary features to make any visitor appreciate the music you put on your site (<span style="color: #ff0000;">remember: using copyrighted music without permission is a crime</span>).</p>
<p>Also important to remember is if you&#8217;re using the Window Glass Shine on your information window, save the shine layer separately so we can put in the labels underneath the glass for better effect.</p>
<p>Here is my user interface design:</p>
<p><img class="aligncenter size-full wp-image-935" title="Player User Interface" src="http://www.minervity.com/wp-content/uploads/2009/02/music-player-done.jpg" alt="Player User Interface" width="182" height="102" /></p>
<h2>Step 2</h2>
<p>Time to set up our flash document. Open a new project and use and set the following settings in &#8220;Publishing Settings&#8230;&#8221; under &#8220;File&#8221; (CTRL+Shift+F12).</p>
<p>Flash Tab:</p>
<ul>
<li>Version: Flash Player 9.0</li>
<li>Load Order: Bottom Up</li>
<li>ActionScript Version: ActionScript 2.0</li>
<li>JPEG Quality: 100%</li>
<li>Audio Stream: MP3, 160kbps, Stereo (this won&#8217;t affect the quality of the sound but I like to set it anyways)</li>
<li>Audio Event: MP3, 160kbps, Stereo (this won&#8217;t affect the quality of the sound but I like to set it anyways)</li>
</ul>
<p>HTML Tab:</p>
<ul>
<li>Quality: Best</li>
</ul>
<p>There, now our publishing settings are set and it&#8217;s time to change some document settings. Open &#8220;Document Properties&#8221; and (if using the same dimensions as me on your user interface (182+102)) set the following:</p>
<ul>
<li>Title: &#8220;XML MP3 Player&#8221;</li>
<li>Dimensions: 182 (width), 102 (height)</li>
<li>Background Color: White (#FFFFFF) &#8211; (Optional, take what suits your interface best)</li>
<li>Frame Rate:  30</li>
</ul>
<h2>Step 3</h2>
<p>Now we&#8217;re going to set up our layers for the player. This time it&#8217;s a few more than usual. We need seven (7) layers this time so go ahead and add another 6 to the list.</p>
<p>After doing so name your layers, top to bottom, &#8220;<strong>actions</strong>&#8220;, &#8220;<strong>shine</strong>&#8220;, &#8220;<strong>text fields</strong>&#8220;, &#8220;<strong>buttons</strong>&#8220;, &#8220;<strong>loader / progress</strong>&#8220;, &#8220;<strong>volume</strong>&#8221; and &#8220;<strong>background</strong>&#8220;. That should be the layers we are going to work with. Of course you can go ahead and add any other layers that you need to make your user interface more interactive. But for this one we only need these.</p>
<h2>Step 4</h2>
<p>Let&#8217;s add our background to the setup. Go to &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Import</strong>&#8221; -&gt; &#8220;<strong>Import To Stage&#8230;</strong>&#8220;. Your image should now be present on your stage. After your background image has been added to the stage make sure you align it correctly using you &#8220;Align&#8221; tool box to your right. Enable the &#8220;To Stage&#8221; button to your farthest right and then align it. This should but the background right where it&#8217;s supposed to be.</p>
<p>Now you should have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-856" title="background &amp; Layer Setup" src="http://www.minervity.com/wp-content/uploads/2009/02/background-layer-setup.jpg" alt="background &amp; Layer Setup" width="272" height="404" /></p>
<h2>Step 5</h2>
<p>Now, let&#8217;s add our little volume slider to the user interface.The first thing we have to do is to set the size of the movie clip itself that will hold our &#8220;Volume Slider&#8221;. So, let&#8217;s go ahead and create a rectangular shape using the tool box to the left. Make the rectangle fit the &#8220;Volume Bar&#8221; exactly. Should look like this (using red just to make it more visible for you. Will make it transparent later on so go ahead and use any color you like):</p>
<p><img class="aligncenter size-full wp-image-864" title="Volume Movie Setup" src="http://www.minervity.com/wp-content/uploads/2009/02/volume-move-setup.jpg" alt="Volume Movie Setup" width="267" height="406" /></p>
<p>Now, select the red rectangle you just created and choose &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8220;. Use the following title and settings:</p>
<p><img class="aligncenter size-full wp-image-863" title="Volume Slider - Movie Convert" src="http://www.minervity.com/wp-content/uploads/2009/02/volume-slider-movie-convert.jpg" alt="Volume Slider - Movie Convert" width="418" height="141" /></p>
<p>Now we have our movie in the size that is needed for our &#8220;Volume Slider&#8221; to work as it is intended to. Now name (instance name) the movie clip &#8220;<strong>volume1</strong>&#8220;.</p>
<p>Double click the newly created movie click. We now enter the movie clips inside so we can manipulate the red rectangle along with adding our &#8220;Volume Slider&#8221;.</p>
<p>Select the red rectangle and once again choose &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol</strong>&#8220;. This time use the exact same settings: Name the symbol &#8220;<strong>Slider</strong>&#8220;. We need to do this in order to be able to be able to manipulate the color of the red rectangle the way we want to. Set the instance name for our new symbol to &#8220;<strong>volBG</strong>&#8220;.</p>
<p>After doing this, if not already selected, select the red rectangle and go to &#8220;Properties&#8221; at the bottom of your screen. There you will find a choice named &#8220;<strong>Color</strong>&#8221; as a roll down menu. In the roll down menu choose &#8220;<strong>Alpha</strong>&#8221; and set the amount to &#8220;<strong>0%</strong>&#8220;. This will make our red rectangle transparent and won&#8217;t be in the way of our slider or make the bar look weird.</p>
<p>Time to add the &#8220;Volume Slider&#8221;.The little slider has been saved separately in Photoshop so we can interact with it and set the volume. While still in the movie clip let&#8217;s add the slider by importing it as usual using the &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Import</strong>&#8221; -&gt; &#8220;<strong>Import To Stage.</strong><strong>..</strong>&#8221; procedure.</p>
<p>When it&#8217;s imported position it all the way to the right on your &#8220;Volume Bar&#8221; to set the volume to maximum when the player is initiated.</p>
<p>We need to create a movie clip out of our &#8220;Volume Slider&#8221; as well. So let&#8217;s repeat the &#8220;<strong>Modif</strong>y&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8221; and name it &#8220;<strong>Volume Controller</strong>&#8220;. Again using the same settings as we used previously. Remember, use the same layer as the red rectangle is on. No need to create a new layer. As instance name set it to &#8220;<strong>dragger</strong>&#8220;.</p>
<p>You should now have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-866" title="Dragger Setup" src="http://www.minervity.com/wp-content/uploads/2009/02/dragger-setup.jpg" alt="Dragger Setup" width="267" height="406" /></p>
<h2>Step 6</h2>
<p>OK, we got our volume control graphics set up. Now it&#8217;s time to set up our loader bar/play progression bar. This will be done almost the same way so remember the &#8220;Convert To Symbol&#8221; procedure.</p>
<p>Alright, let&#8217;s create the loader movie to begin with. Create a <strong>168*2</strong> pixel bar where the loader indicator is positioned on our user interface. Here&#8217;s how it looks like on my user interface:</p>
<p><img class="aligncenter size-full wp-image-872" title="Loader Bar Location" src="http://www.minervity.com/wp-content/uploads/2009/02/loader-bar-location.jpg" alt="Loader Bar Location" width="297" height="396" /></p>
<p>Now we have to convert this shape into a Movie Symbol again. Again, &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8220;. Name it &#8220;<strong>Loader Bar</strong>&#8221; and set it to &#8220;<strong>Movie Clip</strong>&#8220;. Set the instance name to &#8220;<strong>loaderer</strong>&#8220;.</p>
<p>When we have done this, double click on the newly created movie clip to get inside it. In here we&#8217;re going to set up our loader bar. The bar that will indicate how much of the song is loaded. What we need to do first is to create a new layer to house our progress bar. Name the new layer &#8220;<strong>progression</strong>&#8220;. So, again create a bar (pick a color of your choice) that will represent the loader.</p>
<p>I have chosen a blue color for my loading progression bar. We once again have to create a movie clip out of our bar. So once again: &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8220;. Name the symbol &#8220;<strong>Progression</strong>&#8221; and here is an important step. You have to set the focal point to top-left corner for the loading progression bar to progress from left to right when loading.</p>
<p>Now, make the width of your newly created progression bar movie clip to 1 pixel in the &#8220;<strong>Info</strong>&#8221; section in your toolbox to your right. Set the instance name to &#8220;<strong>loaderBar</strong>&#8220;. Now the Loading Progression Bar is all set up.</p>
<p>What we need to do before leaving the insides of this clip is to get rid of the main movie clip size adjuster background. So, let&#8217;s convert the background to a &#8220;<strong>Graphic</strong>&#8221; layer with the same procedure as usual. &#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8220;. Pick the &#8220;<strong>Graphic</strong>&#8221; option and name it &#8220;Loader Background&#8221;.</p>
<p>After converting the background graphics to &#8220;<strong>Graphic</strong>&#8221; again use the Roll Down menu in the &#8220;<strong>Properties</strong>&#8221; box found at the bottom of your screen when selecting your newly created &#8220;Graphic&#8221; symbol. Choose &#8220;<strong>Alpha</strong>&#8221; and set it to &#8220;<strong>0%</strong>&#8221; to make it transparent.</p>
<p>Here&#8217;s how my complete setup looks like:</p>
<p><img class="aligncenter size-full wp-image-873" title="Loader Bar Setup - Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/loader-bar-setup-complete.jpg" alt="Loader Bar Setup - Complete" width="297" height="396" /></p>
<p>Ok, now the loading progression bar is all set up. What we&#8217;re going to do now is to use the loader bar as our player head progression bar as well. Nifty right?! What we need is an indicator that will move along the progression bar as the song is being played to show where in the song we are currently located.</p>
<p>If you haven&#8217;t already, go back to your root, the beginning flash project layout by clicking &#8220;<strong>Scene 1</strong>&#8220;. Let us now import our 4*4 pixel player head to the stage using the usual procedure. &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Import</strong>&#8221; -&gt; &#8220;<strong>Import To Stage&#8230;</strong>&#8221;</p>
<p>Alright with the player head imported, position it on the farthest left of your loader bar. After doing this we again need to convert it to a Movie Symbol to make it usable as a player head.</p>
<p>&#8220;<strong>Modify</strong>&#8221; -&gt; &#8220;<strong>Convert To Symbol&#8230;</strong>&#8220;. Name it &#8220;<strong>Player Head</strong>&#8221; and pick the &#8220;<strong>Movie Clip</strong>&#8221; option. Don&#8217;t forget to set the focal point to the top left corner. Give your newly created movie clip the instance name &#8220;<strong>playHead</strong>&#8220;.</p>
<p>After doing all this you should have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-879" title="Player Head Positioning" src="http://www.minervity.com/wp-content/uploads/2009/02/player-head-positioning1.jpg" alt="Player Head Positioning" width="297" height="396" /></p>
<h2>Step 7</h2>
<p>Wow, we have come a long way already in 7 steps. All the tricky parts are now over and now we come to the more basic functions of the music player. It&#8217;s time to set up our <strong>Play</strong>, <strong>Stop</strong>, <strong>Prev</strong> and <strong>Next</strong> buttons.</p>
<p>When I saved the background for my player I also saved each button in it&#8217;s &#8220;inactive&#8221; state as well as &#8220;active&#8221; state separately. Let us start by importing the &#8220;Play Button&#8221; to the &#8220;<strong>buttons</strong>&#8221; layer and to the stage. I presume you know by now how to do this so I won&#8217;t go in to that again.</p>
<p>After importing the play button (<strong>inactive</strong>) position it right where it&#8217;s supposed to be. OK, all done. Now, let&#8217;s convert this graphic button into a &#8220;<strong>Button</strong>&#8221; symbol. Same procedure as usual. Name the button symbol &#8220;<strong>Play Btn &#8211; Inactive</strong>&#8221; and set the instance name of your newly created button symbol to &#8220;<strong>play_btn</strong>&#8220;.</p>
<p>Now we have our first button. Double click the button to enter the buttons different state stages. As you can see the &#8220;<strong>Up</strong>&#8221; stage is already there. What we need to do right now is to import a our play button graphics in it&#8217;s active state.</p>
<p>Select the &#8220;<strong>Over</strong>&#8221; frame and create a blank key frame. This is done by right clicking the empty &#8220;<strong>Over</strong>&#8221; frame and selecting &#8220;<strong>Insert Blank Keyframe</strong>&#8220;. With this done we can now import the &#8220;active&#8221; state of the button. So, import the play buttons active graphics to our newly created key frame in &#8220;<strong>Over</strong>&#8220;.</p>
<p>We now have a working &#8220;<strong>Play</strong>&#8221; button.</p>
<p>Repeat this with all the three other buttons giving them the instance names: &#8220;<strong>stop_btn</strong>&#8220;, &#8220;<strong>prev_btn</strong>&#8221; and &#8220;<strong>next_btn</strong>&#8220;.</p>
<p>There, our important music player buttons are all in place and you should have something looking like this. Pay attention to the &#8220;Play&#8221; button as it is in an active state. Just to show how they look in active state.</p>
<p><img class="aligncenter size-full wp-image-886" title="Button Setup Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/button-setup-complete.jpg" alt="Button Setup Complete" width="297" height="396" /></p>
<h2>Step 8</h2>
<p>To display &#8220;Song Title&#8221;, &#8220;Artist Name&#8221; and &#8220;Time&#8221; we need to set up some labels. This we will easily do. We are going to add three (3) dynamic text fields in the &#8220;<strong>text fields</strong>&#8221; layer with the instance names: &#8220;<strong>timeDisplay_txt</strong>&#8220;, &#8220;<strong>bandDisplay_txt</strong>&#8221; and &#8220;<strong>titleDisplay_txt</strong>&#8220;.</p>
<p>Remember to &#8220;<strong>embed</strong>&#8221; the font to store it in to the Flash file when published. This way the texts will look the same no matter what visitor sees it.</p>
<p>The aligning of the labels are entirely up to you how you want them to present the information. Just remember to drag the artist name and the song title text fields to their maximum available space as they otherwise will get cut if you have an artist name or a song title that is too long.</p>
<p>This is how I aligned my three labels:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-889" title="Label Layout" src="http://www.minervity.com/wp-content/uploads/2009/02/label-layout1.jpg" alt="Label layout" width="297" height="396" /></p>
<p style="text-align: left;">
<p style="text-align: left;"><strong>IMPORTANT:</strong> Remember that the artist name and title is only for you to see where I have positioned the different labels. Before you save and publish you player you should just make them blank.</p>
<p style="text-align: left;">
<h2 style="text-align: left;">Step 9</h2>
<p>Nice! Now our labels are all setup as well. Just a few things remaining now before we can publish and test our new masterpiece. Now comes the easy part. Adding the &#8220;shine&#8221; layer to the player to make it more realistic in it&#8217;s appearance.</p>
<p>In the &#8220;shine layer&#8221;, import the shine layer to the first frame.</p>
<p>You can either import a PNG file with 100% opacity and then convert the shine into a &#8220;<strong>Graphic</strong>&#8221; layer and the add the &#8220;<strong>Alpha</strong>&#8221; color to it or you can just save a PNG in Photoshop that already has the opacity set to <strong>20%</strong> or whatever shine strength you prefer.</p>
<p>You should now have something like this:</p>
<p><img class="aligncenter size-full wp-image-892" title="Shine Setup" src="http://www.minervity.com/wp-content/uploads/2009/02/shine-setup.jpg" alt="Shine Setup" width="297" height="396" /></p>
<h2>Step 10</h2>
<p>Now comes the heavy part. Don&#8217;t be discouraged though. I will lead you through the entire process and try to explain what it all means. It&#8217;s time for the core. The code to make our player work as intended. It&#8217;s not as complicated as it looks so just stick with me.</p>
<p>In the first frame of our &#8220;<strong>actions</strong>&#8221; layer add this all this code explained underneath. You open the &#8220;<strong>actions</strong>&#8221; window by either right clicking on the first frame in our &#8220;<strong>actions</strong>&#8221; and choose &#8220;<strong>Actions</strong>&#8221; at the bottom of the list or you can just press &#8220;<strong>F9</strong>&#8220;The full code will be presented in the end. I just want to go through the parts of it so you understand what the code does.</p>
<blockquote><p>stop();<br />
playlist = new XML();<br />
playlist.ignoreWhite = true;<br />
playlist.onLoad = function(success) {<br />
if (success) {<br />
_global.songname = [];<br />
_global.songband = [];<br />
_global.songfile = [];<br />
for (var i = 0; i&lt;playlist.firstChild.childNodes.length; i++) {<br />
_global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;<br />
_global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;<br />
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;<br />
//trace(songname[i]+&#8221;  &#8220;+songfile[i]+&#8221; &#8220;+songband[i]);<br />
}<br />
}<br />
_root.createEmptyMovieClip(&#8220;sound_mc&#8221;, 1);<br />
_global.song_nr = random(songfile.length);<br />
//_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);<br />
};</p></blockquote>
<p>OK, lot of code here. No worries. I am going to explain the main parts of it.</p>
<p><strong>Line 1</strong> &#8211; Just makes sure that our flash movie doesn&#8217;t loop and re-setup our player. Instead it stops and waits for us to interact with the player, such as pressing the play button.</p>
<p><strong>Line 2</strong> &#8211; Creates a variable for our play list later created in an XML file.</p>
<p><strong>Line 3</strong> &#8211; Will simply ignore any line breaks in our play list to make sure it&#8217;s read from top to bottom correctly.</p>
<p><strong>Line 4 through 12</strong> &#8211; scans out play list for the information such as Song Title, Artist Name and File and puts them in variables later accessible for our player when pressing the Play button.</p>
<p><strong>Line 13</strong> &#8211; sets up our sound channel. Opens it if you will.</p>
<p><strong>Line 14</strong> &#8211; randomizes the place where the player starts playing in the play list.</p>
<p><strong>Line 15</strong> &#8211; As you can see I have two slashes in front of the line. This is because if we didn&#8217;t the player would start playing automatically as soon as it&#8217;s loaded. If you want this function just take off the two slashes and you player is all setup to start playing as soon as it loads.</p>
<p><strong>Line 16</strong> &#8211; Closes the function.</p>
<p>There, let&#8217;s move to the next part of the script.</p>
<blockquote><p>function timer(sound_obj) {<br />
time = sound_obj.position/1000;<br />
min = Math.floor(time/60);<br />
min = (min&lt;10) ? &#8220;0&#8243;+min : min;<br />
sec = Math.floor(time%60);<br />
sec = (sec&lt;10) ? &#8220;0&#8243;+sec : sec;<br />
timeDisplay_txt.text = min+&#8221;:&#8221;+sec;<br />
}</p></blockquote>
<p>This function is all for the timer of the player. Showing how much of the song that has been played. Let&#8217;s go through the code.</p>
<p><strong>Line 1</strong> &#8211; Opens up the timer procedure of the sound channel allowing us to keep track of where the player head is located.</p>
<p><strong>Line 2</strong> &#8211; Creates a variable holding the total length of the song.</p>
<p><strong>Line 3</strong> &#8211; Calculates the number of minutes that has passed.</p>
<p><strong>Line 4</strong> &#8211; If total amount of minutes are less than 10 we add a zero in front of the number to  keep our layout the same.</p>
<p><strong>Line 5</strong> &#8211; Calculates the number of seconds that has passed.</p>
<p><strong>Line 6</strong> &#8211; If total amount of seconds are less than 10 we add a zero in front of the number to keep our layout the same.</p>
<p><strong>Line 7</strong> &#8211; Sends and prints our result to our &#8220;timeDisplay_txt&#8221; instance label.</p>
<p><strong>Line 8</strong> &#8211; Closing our function.</p>
<p>Now our timer is all set up and it&#8217;s time to move on over to the part that actually handles the play operation. This includes the sound channel setup and our volume control.</p>
<blockquote><p>MovieClip.prototype.songStarter = function(file, name, band) {<br />
if (this.sound_obj) {<br />
this.sound_obj.stop();<br />
delete this.sound_obj;<br />
}<br />
this.sound_obj = new Sound(this);<br />
this.sound_obj.loadSound(file, true);<br />
this.onEnterFrame = function() {<br />
if (this.sound_obj.position&gt;0) {<br />
delete this.onEnterFrame;<br />
this._parent.titleDisplay_txt.text = &#8220;&#8216;&#8221;+name+&#8221;&#8216;&#8221;;<br />
this._parent.bandDisplay_txt.text = band;<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
timeInterval = setInterval(timer, 1000, this.sound_obj);<br />
} else {<br />
this._parent.bandDisplay_txt.text = &#8220;Loading&#8230;&#8221;;<br />
}<br />
};<br />
this.sound_obj.onSoundComplete = function() {<br />
clearInterval(timeInterval);<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;<br />
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);<br />
};<br />
this._parent.volume1.dragger.onPress = function() {<br />
startDrag(this, true, 1, this._y, this._parent.volBG._width-10, this._y);<br />
this.onEnterFrame = function() {<br />
var p = (this._x/this._parent.volBG._width)*100;<br />
this._parent._parent.sound_mc.sound_obj.setVolume(p);<br />
};<br />
};<br />
this._parent.volume1.dragger.onRelease = function() {<br />
delete this.onEnterFrame;<br />
stopDrag();<br />
};<br />
this._parent.volume1.dragger.onReleaseOutside = function() {<br />
stopDrag();<br />
};<br />
};</p></blockquote>
<p>This time it&#8217;s a lot of code. Again, no worries. It&#8217;s all pretty straight forward.</p>
<p><strong>Line 1</strong> &#8211; Opens up our songStarter function. Starts it off.</p>
<p><strong>Line 2 through 5</strong> &#8211; Checks if something is currently playing. If it is, then that object is stopped and deleted.</p>
<p><strong>Line 6</strong> &#8211; Creates a new sound channel for our song.</p>
<p><strong>Line 7</strong> &#8211; Loads the file currently in line in our play list.</p>
<p><strong>Line 8</strong> &#8211; Opens up a &#8220;This Frame&#8221; function. Meaning whenever our flash movie enters this frame this function will be executed.</p>
<p><strong>Line 9 through 10</strong> &#8211; Checking if the position of the player head is larger than 0. If it is it&#8217;s deleted.</p>
<p><strong>Line 11 through 13</strong> &#8211; Resets all the labels and the timer to blank and zero.</p>
<p><strong>Line 14</strong> &#8211; Resetting the timer interval.</p>
<p><strong>Line 15 through 17</strong> &#8211; If labels and timer already is reset &#8220;Loading&#8230;&#8221; is printed out to our bandDisplay label.</p>
<p><strong>Line 18</strong> &#8211; Function closed.</p>
<p><strong>Line 19</strong> &#8211; Opens up a new function. This function handles the &#8220;next&#8221; track when the current track has been played to the end and is completed.</p>
<p><strong>Line 20</strong> &#8211; Resets the interval.</p>
<p><strong>Line 21</strong> &#8211; Resets the &#8220;Timer&#8221; label to &#8220;00:00&#8243;.</p>
<p><strong>Line 22</strong> &#8211; Adds one to the play list counter location and progresses to the next track in the play list.</p>
<p><strong>Line 23</strong> &#8211; Locates, loads and starts the next track in the play list.</p>
<p><strong>Line 24</strong> &#8211; Function closed.</p>
<p><strong>Line 25</strong> &#8211; Opens up volume dragger function &#8211; The onPress function.</p>
<p><strong>Line 26</strong> &#8211; Checks the newest position of the volume dragger.</p>
<p><strong>Line 27</strong> &#8211; Opens up an onEnter Frame function to locate the dragger at initialization.</p>
<p><strong>Line 28</strong> &#8211; Sets the minimum and maximum &#8220;x&#8221; limits of our volume dragger.</p>
<p><strong>Line 29</strong> &#8211; Sets the volume according to the location of the volume dragger.</p>
<p><strong>Line 30</strong> &#8211; Function (volume onPress) closed.</p>
<p><strong>Line 31</strong> &#8211; Function (SoundComplete) closed.</p>
<p><strong>Line 32</strong> &#8211; Opens a onRelease function for the volume dragger.</p>
<p><strong>Line 33</strong> &#8211; Resets the dragger on Frame enter.</p>
<p><strong>Line 34</strong> &#8211; Stops dragging.</p>
<p><strong>Line 35</strong> &#8211; Function closed.</p>
<p><strong>Line 36</strong> &#8211; Opens an (outside release) onRelease function.</p>
<p><strong>Line 37</strong> &#8211; Stops dragging.</p>
<p><strong>Line 38</strong> &#8211; Function closed.</p>
<p><strong>Line 39</strong> &#8211; Main function (songStarter) closed.</p>
<p>A lot of code there huh? But it wasn&#8217;t that hard was it? On to the code that handles the loader bar and the progression indicator. This part is somewhat easier and not so complex.</p>
<blockquote><p>setInterval(soundStatus,100);<br />
function soundStatus(){<br />
var amountLoaded = _root.sound_mc.sound_obj.getBytesLoaded() / _root.sound_mc.sound_obj.getBytesTotal();<br />
_root.loaderer.loaderBar._width = amountLoaded * 168;<br />
duration = _root.sound_mc.sound_obj.duration;<br />
position = _root.sound_mc.sound_obj.position;<br />
_root.playHead._x = position / duration * 165+6;<br />
}</p></blockquote>
<p><strong>Line 1</strong> &#8211; Resets our soundStatus interval to 100.</p>
<p><strong>Line 2</strong> &#8211; Opens up a soundStatus function.</p>
<p><strong>Line 3</strong> &#8211; Creates a variable to hold the amount loaded.</p>
<p><strong>Line 4</strong> &#8211; Checks the total amount of bytes for our song file.</p>
<p><strong>Line 5</strong> &#8211; Sets total file size to be 100% of the loader bar. (168 being the total width of my loader bar)</p>
<p><strong>Line 6</strong> &#8211; A variable holding the current duration of the load.</p>
<p><strong>Line 7</strong> &#8211; A variable holding the current location of the load.</p>
<p><strong>Line 8</strong> &#8211; Sets the width of our loader bar to the current progress in percentage.</p>
<p><strong>Line 9</strong> &#8211; Function closed.</p>
<p>That should be it for our loader progression bar. Now let us head on to our buttons. This is the fun part actually setting up some user interaction with our player. Let&#8217;s take a button at a time.</p>
<blockquote><p>play_btn.onRelease = function() {<br />
clearInterval(timeInterval);<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
_root.playHead._x = 7;<br />
this._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);<br />
};</p></blockquote>
<p><strong>Line 1</strong> &#8211; Opens up a &#8220;play_btn&#8221; onRelease function. This will be executed each time you press the &#8220;<strong>Play</strong>&#8221; button.</p>
<p><strong>Line 2</strong> &#8211; Resets the timeInterval variable.</p>
<p><strong>Line 3</strong> &#8211; Resets the timer label to &#8220;00:00&#8243;.</p>
<p><strong>Line 4</strong> &#8211; Brings our player head back to start position.</p>
<p><strong>Line 5</strong> &#8211; Starts the current song loaded.</p>
<p><strong>Line 6</strong> &#8211; Function closed.</p>
<p>Easy huh? Not much to it was it. Now our &#8220;<strong>Play</strong>&#8221; button should be working all good. On to the &#8220;<strong>Stop</strong>&#8221; button.</p>
<blockquote><p>stop_btn.onRelease = function() {<br />
clearInterval(timeInterval);<br />
_root.playHead._x = 7;<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
this._parent.titleDisplay_txt.text = &#8220;&#8221;<br />
this._parent.bandDisplay_txt.text = &#8220;&#8221;;<br />
this._parent.sound_mc.sound_obj.stop();<br />
};</p></blockquote>
<p><strong>Line 1</strong> &#8211; Opens up a &#8220;stop_btn&#8221; onRelease function. This will be executed each time you press the &#8220;<strong>Stop</strong>&#8221; button.</p>
<p><strong>Line 2</strong> &#8211; Resets the timeInterval variable.</p>
<p><strong>Line 3</strong> &#8211; Brings the player head right back to it&#8217;s starting position.</p>
<p><strong>Line 4</strong> &#8211; Resets the timer label to &#8220;00:00&#8243;.</p>
<p><strong>Line 5</strong> &#8211; Resets the &#8220;<strong>Song Title</strong>&#8221; label to blank.</p>
<p><strong>Line 6</strong> &#8211; Resets the &#8220;Artist Name&#8221; label to blank.</p>
<p><strong>Line 7</strong> &#8211; Stops the current song playing on our sound channel.</p>
<p><strong>Line 8</strong> &#8211; Function closed.</p>
<p>That&#8217;s out &#8220;<strong>Stop</strong>&#8221; button interaction completed. Now both our &#8220;<strong>Stop</strong>&#8221; and &#8220;<strong>Play</strong>&#8221; buttons should be working as intended. Now what remains is our &#8220;<strong>Next</strong>&#8221; and &#8220;<strong>Prev</strong>&#8221; song buttons. Let&#8217;s go straight to the &#8220;<strong>Next</strong>&#8221; button code.</p>
<blockquote><p>next_btn.onRelease = function() {<br />
clearInterval(timeInterval);<br />
_root.playHead._x = 7;<br />
this._parent.bandDisplay_txt.text = &#8220;Loading&#8230;&#8221;;<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;<br />
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);<br />
};</p></blockquote>
<p><strong>Line 1</strong> &#8211; Opens up a &#8220;next_btn&#8221; onRelease function. This will be executed each time you press the &#8220;<strong>Next</strong>&#8221; button.</p>
<p><strong>Line 2</strong> &#8211; Resets the timeInterval variable.</p>
<p><strong>Line 3</strong> &#8211; Brings the player head straight back to it&#8217;s start position.</p>
<p><strong>Line 4</strong> &#8211; Adds &#8220;loading&#8230;&#8221; to bandDisplay label.</p>
<p><strong>Line 5</strong> &#8211; Resets the timer label to &#8220;00:00&#8243;.</p>
<p><strong>Line 6 through 7</strong> &#8211; Gets the next Song info in the play list and starts loading it. After loading it automatically starts playing.</p>
<p><strong>Line 8</strong> &#8211; Function closed.</p>
<p>That should wrap up our &#8220;<strong>Next</strong>&#8221; button interaction. Now all that&#8217;s left of the button&#8217;s is the &#8220;<strong>Prev</strong>&#8221; button interaction code. Let&#8217;s do it.</p>
<blockquote><p>prev_btn.onRelease = function() {<br />
clearInterval(timeInterval);<br />
_root.playHead._x = 7;<br />
this._parent.bandDisplay_txt.text = &#8220;Loading&#8230;&#8221;;<br />
this._parent.timeDisplay_txt.text = &#8220;00:00&#8243;;<br />
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr&#8211;;<br />
_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);<br />
};</p></blockquote>
<p><strong>Line 1</strong> &#8211; Opens up a &#8220;prev_btn&#8221; onRelease function. This will be executed each time you press the &#8220;<strong>Prev</strong>&#8221; button.</p>
<p><strong>Line 2</strong> &#8211; Resets the timeInterval variable.</p>
<p><strong>Line 3</strong> &#8211; Brings our player head right back to it&#8217;s starting position.</p>
<p><strong>Line 4</strong> &#8211; Adds &#8220;loading&#8230;&#8221; to our bandDisplay label.</p>
<p><strong>Line 5</strong> &#8211; Resets the timer label to &#8220;00:00&#8243;</p>
<p><strong>Line 6 through 7</strong> &#8211; Gets the previous song info on the play list and starts loading it. After loading the song will start automatically.</p>
<p><strong>Line 8</strong> &#8211; Function closed.</p>
<p>Well, that should be all of our button&#8217;s. The button interaction is now all completed and there is only one thing left we have to add to our code in order to make it work properly. We of course have to load our play list. Our XML file not yet created. It&#8217;s only one line so it should be really easy.</p>
<blockquote><p>playlist.load(&#8220;playlist.xml&#8221;);</p></blockquote>
<p><strong>Line 1</strong> &#8211; Basically loads our play list from the file location. If using a folder or a sub folder you can just go ahead and add the pathway for it not including the root. For example. If I am using a folder called &#8220;<strong>XML Player&#8221;</strong> my code would look like this:</p>
<blockquote><p>playlist.load(&#8220;/XML Player/playlist.xml&#8221;);</p></blockquote>
<p>Simple huh?</p>
<p>Our code is now all done and all that is left to do now is actually to create our play list and then upload the whole thing to our server.</p>
<h2>Step 11</h2>
<p>The last thing we&#8217;re going to do in creating our XML Mp3 Music Player is to create our XML file. This is the main part of our Player and it&#8217;s what we&#8217;ll be modifying ever once in a while to switch up music for our player. <span style="color: #ff0000;">Remember, using copyrighted music without permission is a crime.</span></p>
<p>Now let us see how our play list shall be setup correctly. Open your favorite word processor and type or copy the following (accept you using your own songs). My play list is looking something like this. I am using songs from my yet unreleased album so enjoy the preview. And yes, I am also a writer/producer.</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;songs&gt;<br />
&lt;song name =&#8221;Give Her A Break&#8221; band =&#8221;Richard Darell&#8221; file=&#8221;/site player/Give Her A Break.mp3&#8243; /&gt;<br />
&lt;song name =&#8221;Leavin Me Numb&#8221; band =&#8221;Richard Darell&#8221; file=&#8221;/Site Player/Leavin Me Numb.mp3&#8243; /&gt;<br />
&lt;song name =&#8221;Hollywood Movie&#8221; band =&#8221;Richard Darell&#8221; file=&#8221;/Site Player/Hollywood Movie.mp3&#8243; /&gt;<br />
&lt;/songs&gt;</p></blockquote>
<p>As you can see it&#8217;s neither hard or complicated. Actually it&#8217;s very structured.</p>
<p><strong>Line 1</strong> &#8211; Tells the browser/computer that this is going to be an XML document.</p>
<p><strong>Line 2</strong> &#8211; Tells our player that this is the start of our play list.</p>
<p><strong>Line 3</strong> -</p>
<ul>
<li>The &#8220;song name&#8221; is where you will be putting the &#8220;Song Title&#8221; for your song.</li>
<li>The &#8220;band&#8221; is where your &#8220;Artist Name&#8221; goes.</li>
<li>Finally &#8220;file&#8221; is where the location of your song will be found.</li>
</ul>
<p>Pretty simple right? Just keep adding songs as many as you like.</p>
<p><strong>Line 4</strong> &#8211; Tells our player that this is the end of our play list.</p>
<p>Alright, the Music Player should now look something like this being done:</p>
<p><img class="aligncenter size-full wp-image-913" title="Music Player - Complete" src="http://www.minervity.com/wp-content/uploads/2009/02/complete-movie.jpg" alt="Music Player - Complete" width="297" height="396" /></p>
<p>Yeah, that should be it. Time to actually save our Flash movie and get it published before we open up our favorite FTP software to upload it to our server.</p>
<h2>Step 12</h2>
<p>With everything set up correctly and everything ready all that&#8217;s left to do is to save our newly created player and then publish it before we upload it.</p>
<p>So, save your project as &#8220;Website Player&#8221; by &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Save</strong>&#8221; or by pressing <strong>&#8220;Ctrl+S</strong>&#8220;. After saving our player let&#8217;s publish it by going to &#8220;<strong>File</strong>&#8221; -&gt; &#8220;<strong>Publish</strong>&#8220;.</p>
<p>There. The final step was finally completed. Now what we have to do is to upload it to a server and test it. Don&#8217;t forget to upload your song to your chosen location.</p>
<h2>Step 13</h2>
<p>Alright, now when our Music Player is all created, saved, published and uploaded to our server, we need to add the HTML code to our blog/website where we want to place it.</p>
<p>The HTML code you will be adding anywhere of your choice is looking like this:</p>
<blockquote><p>&lt;object classid=&#8221;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0&#8243; width=&#8221;180&#8243; height=&#8221;100&#8243; id=&#8221;Website Player&#8221; align=&#8221;middle&#8221;&gt;</p>
<p>&lt;param name=&#8221;allowScriptAccess&#8221; value=&#8221;sameDomain&#8221; /&gt;</p>
<p>&lt;param name=&#8221;allowFullScreen&#8221; value=&#8221;false&#8221; /&gt;</p>
<p>&lt;param name=&#8221;movie&#8221; value=&#8221;/site player/Website Player.swf&#8221; /&gt;</p>
<p>&lt;param name=&#8221;quality&#8221; value=&#8221;best&#8221; /&gt;</p>
<p>&lt;param name=&#8221;bgcolor&#8221; value=&#8221;#ffffff&#8221; /&gt;</p>
<p>&lt;embed src=&#8221;/site player/Website Player.swf&#8221; quality=&#8221;best&#8221; bgcolor=&#8221;#ffffff&#8221; width=&#8221;180&#8243; height=&#8221;100&#8243; name=&#8221;Website Player&#8221; align=&#8221;middle&#8221; allowScriptAccess=&#8221;sameDomain&#8221; allowFullScreen=&#8221;false&#8221; type=&#8221;application/x-shockwave-flash&#8221; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; /&gt;</p>
<p>&lt;/object&gt;</p></blockquote>
<p>There, that should be all. Now test you player to make sure it works as intended. Here is an example of my player. Go ahead and try it out.</p>
<h2>Working Example</h2>
<p style="padding-left: 180px; padding-top:40px; padding-bottom:40px;"><object width="180" height="100" data="/site player/Website Player.swf" type="application/x-shockwave-flash"><param name="align" value="middle" /><param name="name" value="Website Player" /><param name="bgcolor" value="#ffffff" /><param name="src" value="/site player/Website Player.swf" /><param name="allowfullscreen" value="false" /><param name="quality" value="best" /></object></p>
<h2>Round Up</h2>
<p>Wow, that went fast! As you can see it&#8217;s quite simple to add a complex music player to your website without too much work. I am sure you are able to create this player within an hour or so if you have a clear idea what kind of user interface you want to create.</p>
<p>I am also sure your visitors will enjoy a little music while they read your blog or surf your site. This player is super solid and stable so go right ahead and use it in any way you like.</p>
<p>I hope you have enjoyed this tutorial as much as I have enjoyed writing and creating it. There are plenty more tutorials on the site to enhance the experience for your visitors that visits your site or blog. You are more than welcome to check them out.</p>
<p>Now I&#8217;m off for a little break before I will hit the computer again to create another tutorial I&#8217;ve had in my mind for ages now.</p>
<p>Looking forward hearing from you so please comment if you have the time.</p>
<p>Thank you!</p>
<img src="http://www.minervity.com/?ak_action=api_record_view&id=844&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.minervity.com/features/flash_tutorial/how-to-create-a-flash-xml-playlist-music-player/feed/</wfw:commentRss>
		<slash:comments>87</slash:comments>
		</item>
		<item>
		<title>How To Create a &#8220;LIVE&#8221; Count-Up</title>
		<link>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-count-up/</link>
		<comments>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-count-up/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 05:39:01 +0000</pubDate>
		<dc:creator>Richard Darell</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript2.0]]></category>
		<category><![CDATA[Count]]></category>
		<category><![CDATA[Count Down]]></category>
		<category><![CDATA[Count-Up]]></category>
		<category><![CDATA[Counter]]></category>
		<category><![CDATA[Easy]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Live]]></category>
		<category><![CDATA[New Generation]]></category>
		<category><![CDATA[Step]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.minervity.com/?p=803</guid>
		<description><![CDATA[Introduction
I have gotten some great reviews for my latest tutorial &#8220;How To Create a &#8220;LIVE&#8221; Visitor Counter&#8221; and I have been requested by many to make a tutorial of my &#8220;Count Up&#8221; application featured here ...]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-821" style="margin-right:10px; margin-bottom:40px" title="Article Title Image" src="http://www.minervity.com/wp-content/uploads/2009/02/calcu-article-image.jpg" alt="Article Title Image" width="200" height="225" />Introduction</h2>
<p>I have gotten some great reviews for my latest tutorial &#8220;<a title="Tutorial Link" href="http://www.minervity.com/?p=715" target="_blank">How To Create a &#8220;LIVE&#8221; Visitor Counter</a>&#8221; and I have been requested by many to make a tutorial of my &#8220;Count Up&#8221; application featured here on my site. So I thought, why not! Let&#8217;s give them what they want. Isn&#8217;t that what freemiums are all about?</p>
<p>This tutorial requires, as my previous tutorials, nothing more than the basic knowledge of Flash and ActionScript. Some basic knowledge of FTP and HTML is also required, however this is mostly a copy and paste situation so if you don&#8217;t possess this knowledge I am sure you are able to follow this tutorial with flying colors anyways. It&#8217;s pretty straight forward and I believe anyone could read this and be able to create their own count-up. With a little bit of focus and bit of patience it should be all good. Let&#8217;s start.</p>
<h2>Step 1</h2>
<p>Just like in my previous tutorial, mentioned in the introduction, we need a background. To make it easy I have chosen to take the same background as in the Live Visitor Counter tutorial. But of course you can go ahead and create your very own background in whatever size or shape that you want it to have. For this one however I have once again chose the 200*38 size with two layers creating that depth effect. Here&#8217;s my flattened layer consisting of two layers:</p>
<p style="text-align: center;"><img class="size-full wp-image-717 aligncenter" title="Counter Background" src="http://www.minervity.com/wp-content/uploads/2009/01/counter-background-full.jpg" alt="Counter Background" width="200" height="38" /></p>
<p style="text-align: left;">Once again, when creating your own background and are using layers, to create the depth effect, make sure you separate the &#8220;on top&#8221; layers from the &#8220;background layers to be able to put the text in between.</p>
<h2 style="text-align: left;">Step 2</h2>
<p>OK, we have our background. Time to setup our project in Flash. Open up a new project and make it in ActionScript2.0. First thing we&#8217;re going to do is to set the Document Properties so we get the right size and speed of the application. So, open up &#8220;Document Properties&#8221; (Ctrl+J) and set the width to 200 and the height to 38. Also change the FPS (frames per second) from 12 to 30. This is to make sure we get an even second for each second. Also set the background to black black (#000000) as it&#8217;s mostly much easier to see if you&#8217;ve made any mistakes in your aligning later on. Don&#8217;t forget to name your project. I have chosen to name it &#8220;Live Count-Up&#8221;. Now you should have something similar to this:</p>
<p><img class="aligncenter size-full wp-image-804" title="Project Settings" src="http://www.minervity.com/wp-content/uploads/2009/02/project-settings.jpg" alt="Project Settings" width="382" height="350" /></p>
<h2>Step 3</h2>
<p>It&#8217;s time to set up our layers for the project. Create 4 (four) new layers making it a total of 5 (five) layers. Name them, from the bottom up, &#8220;background&#8221;, &#8220;labels&#8221;, &#8220;textfields&#8221;, &#8220;shine&#8221; and &#8220;actions&#8221;. Your setup should now look something like this:</p>
<p><img class="aligncenter size-full wp-image-805" title="Layer Setup" src="http://www.minervity.com/wp-content/uploads/2009/02/layer-setup.jpg" alt="Layer Setup" width="335" height="355" /></p>
<h2>Step 4</h2>
<p>The first layer to get some content is actually our &#8220;actions&#8221; layer. Open up &#8220;Actions&#8221; view by selecting the first frame of the &#8220;actions&#8221; layer and right click on it. Choose &#8220;Actions&#8221; at the bottom of the list. Now, input this:</p>
<blockquote><p>this.onEnterFrame = function() {</p>
<p>var trueday:Date = new Date();<br />
var trueYear = trueday.getFullYear();<br />
var trueTime = trueday.getTime();</p>
<p>var startDate:Date = new Date(2008,11,12);<br />
var startTime = startDate.getTime();</p>
<p>var timeLeft = trueTime &#8211; startTime;</p>
<p>var sec = Math.floor(timeLeft/1000);<br />
var min = Math.floor(sec/60);<br />
var hrs = Math.floor(min/60);<br />
var days = Math.floor(hrs/24);</p>
<p>sec = string(sec % 60);<br />
if (sec.length &lt; 2) {<br />
sec = &#8220;0&#8243; + sec;<br />
}<br />
min = string(min % 60);<br />
if (min.length &lt; 2) {<br />
min = &#8220;0&#8243; + min;<br />
}<br />
hrs = string(hrs % 24);<br />
if (hrs.length &lt; 2) {<br />
hrs = &#8220;0&#8243; + hrs;<br />
}<br />
days = string(days);</p>
<p>var countup:String = days+ &#8220;:&#8221; + hrs + &#8220;:&#8221; + min + &#8220;:&#8221; + sec;<br />
countprnt.text = countup;<br />
}</p></blockquote>
<p>Now you&#8217;re thinking. Wow, that&#8217;s a lot of code and he said it was to be basic. No worries. I will try and explain the basics of the code line by line so you know what it does.</p>
<p><span style="text-decoration: underline;"><em>Line 1</em></span></p>
<blockquote><p>this.onEnterFrame = function() {</p></blockquote>
<p>This line opens up our script each time we the cycle hits this frame. What it means is that everytime our flash movie enters his frame it executes the ActionScript.</p>
<p><span style="text-decoration: underline;"><em>Line 2</em></span></p>
<blockquote><p>var trueday:Date = new Date();</p></blockquote>
<p>This line creates a variable for us to store the current date. The updated date so to say.</p>
<p><span style="text-decoration: underline;"><em>Line 3</em></span></p>
<blockquote><p>var trueYear = trueday.getFullYear();</p></blockquote>
<p>This line stores the current year in a variable named trueYear.</p>
<p><span style="text-decoration: underline;"><em>Line 4</em></span></p>
<blockquote><p>var trueTime = trueday.getTime();</p></blockquote>
<p>This line stores the current time in a variable named trueTime.</p>
<p><span style="text-decoration: underline;"><em>Line 5</em></span></p>
<blockquote><p>var startDate:Date = new Date(2008,11,12);</p></blockquote>
<p>This line is the only one you have to pay close attention to really. This line stores the date that you want the counter to start it&#8217;s count-up from. Also, this line has some more explaining to do. The layout of the date within the parentecies is Year, Month, Date. But, one thing that is really important here is the months only goes to 11. Meaning December is 11. It is like this because the computer counts January as month number 0. This is important when you add your date here.</p>
<p><span style="text-decoration: underline;"><em>Line 6</em></span></p>
<blockquote><p>var startTime = startDate.getTime();</p></blockquote>
<p>This line stores the startDate&#8217;s time. Meaning if you have entered it it will also include it down to the second.</p>
<p><span style="text-decoration: underline;"><em>Line 7</em></span></p>
<blockquote><p>var timeLeft = trueTime &#8211; startTime;</p></blockquote>
<p>Here is the calculation that calculates how many days, hours, minutes and seconds has passed since the start.</p>
<p><span style="text-decoration: underline;"><em>Line 8</em></span></p>
<blockquote><p>var sec = Math.floor(timeLeft/1000);</p></blockquote>
<p>This line calculates the milliseconds into the number of seconds.</p>
<p><span style="text-decoration: underline;"><em>Line 9</em></span></p>
<blockquote><p>var min = Math.floor(sec/60);</p></blockquote>
<p>This line calculates the seconds into the number of minutes.</p>
<p><span style="text-decoration: underline;"><em>Line 10</em></span></p>
<blockquote><p>var hrs = Math.floor(min/60);</p></blockquote>
<p>This line calculates the minutes into the number of hours.</p>
<p><span style="text-decoration: underline;"><em>Line 11</em></span></p>
<blockquote><p>var days = Math.floor(hrs/24);</p></blockquote>
<p>This line calculates the hours into the number of days.</p>
<p><span style="text-decoration: underline;"><em>Line 12</em></span></p>
<blockquote><p>sec = string(sec % 60);</p></blockquote>
<p>This line calculates the total number of seconds that have passed.</p>
<p><span style="text-decoration: underline;"><em>Line 13</em></span></p>
<blockquote><p>if (sec.length &lt; 2) {<br />
sec = &#8220;0&#8243; + sec;<br />
}</p></blockquote>
<p>These lines adds a zero (0) in front of the seconds if the total number of seconds are less than 10. We do this to make sure we always have a two digit print out on our count-up.</p>
<p><span style="text-decoration: underline;"><em>Line 14</em></span></p>
<blockquote><p>min = string(min % 60);</p></blockquote>
<p>This line calculates the total number of minutes that have passed.</p>
<p><span style="text-decoration: underline;"><em>Line 15</em></span></p>
<blockquote><p>if (min.length &lt; 2) {<br />
min = &#8220;0&#8243; + min;<br />
}</p></blockquote>
<p>These lines adds a zero (0) in front of the minutes if the total number of minutes are less than 10. We do this to make sure we always have a two digit print out on our count-up. Just like in the seconds.</p>
<p><span style="text-decoration: underline;"><em>Line 16</em></span></p>
<blockquote><p>hrs = string(hrs % 24);</p></blockquote>
<p>This line calculates the total number of hours that have passed.</p>
<p><span style="text-decoration: underline;"><em>Line 17</em></span></p>
<blockquote><p>if (hrs.length &lt; 2) {<br />
hrs = &#8220;0&#8243; + hrs;<br />
}</p></blockquote>
<p>These lines ads a zero (0) in front of the hours if the total number of hours are less then 10. We do this to make sure we always have a two digit print out on our count-up. Just like in the seconds and the minutes.</p>
<p><span style="text-decoration: underline;"><em>Line 18</em></span></p>
<blockquote><p>days = string(days);</p></blockquote>
<p>This line stores the total number of days that have passed.</p>
<p><span style="text-decoration: underline;"><em>Line 19</em></span></p>
<blockquote><p>var countup:String = days+ &#8220;:&#8221; + hrs + &#8220;:&#8221; + min + &#8220;:&#8221; + sec;</p></blockquote>
<p>This line stores our print out in the right order. It combines all of our calculated variables and stitches it into one string variable ready for prin out.</p>
<p><em><span style="text-decoration: underline;">Line 20</span></em></p>
<blockquote><p>countprnt.text = countup;</p></blockquote>
<p>This line prints our string to countprnt.text which will be our dynamic text field where we see our count-up progress.</p>
<p><em><span style="text-decoration: underline;">Line 21</span></em></p>
<blockquote><p>}</p></blockquote>
<p>This line just closes our script.</p>
<h2>Step 5</h2>
<p>OK, now we&#8217;re done with the ActionScript. Time to add the visible&#8217;s to the counter. Let&#8217;s add the background. Choose &#8220;<strong>File</strong> -&gt; <strong>Import</strong> -&gt; <strong>Import To Stage&#8230;</strong>&#8220;. Pick your background and click ok. If all is ok it should align itself to your workspace. It should now look something like this:</p>
<p><img class="aligncenter size-full wp-image-810" title="Background Layout" src="http://www.minervity.com/wp-content/uploads/2009/02/background-layout.jpg" alt="Background Layout" width="335" height="355" /></p>
<h2>Step 6</h2>
<p>Our background is in place and we need to insert our labels. The labels that will tell the viewer what he/she is looking at. Let&#8217;s start with the title. Let&#8217;s add &#8220;SINCE LAUNCH&#8221; title to the count-up in the upper right corner in the first frame of the &#8220;labels&#8221; layer. I have chosen the font &#8220;Trebuchet MS&#8221; size 7 to make it clean and tidy. You can go ahead and use whatever font you feel fits your needs. Now we have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-811" title="Title Label" src="http://www.minervity.com/wp-content/uploads/2009/02/title-label.jpg" alt="Title Label" width="335" height="355" /></p>
<p>I have chosen not to add the bottom labels yet as we want to make sure first where they go. This we do by inserting the actual counter.</p>
<h2>Step 7</h2>
<p>Time to insert the core of the count-up. The count-up itself. In the first frame of the &#8220;textfields&#8221; layer let&#8217;s add a dynamic text field with the text &#8220;000:00:00:00&#8243; indicating where the digits will go. I have chosen Arial as font and 18 as size. I also picked Bold to give it more body. I gave it a slight bright gray to make it stand out a bit from the titles pure white color.</p>
<p>Before we enter the next step we need to give our text field and instance name so that our ActionScript can push it&#8217;s data to it. So, click the newly created dynamic text field with out zeros in it and give it an instance name of &#8220;countprnt&#8221; which you will also find in our script. ALSO, make sure you widen the text field all the way to the left to give it more room for more digits.</p>
<p>IMPORTANT: Make sure you have right aligned the text in the dynamic text field so that the increment always looks the same. You should now have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-812" title="Readout Layout" src="http://www.minervity.com/wp-content/uploads/2009/02/readout-layout.jpg" alt="Readout Layout" width="335" height="355" /></p>
<h2>Step 8</h2>
<p>There. Now we can go ahead and add the last labels to the count-up as we have the guide now to align them. We&#8217;ll need to add 4 different static text fields to do this. Under the far right zero&#8217;s you type &#8220;SEC&#8221;, then &#8220;MIN&#8221;, &#8220;HRS&#8221; and &#8220;DAYS&#8221;. I have used the same font and size as in the title label. Same color and everything. You should now have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-813" title="Label Layout" src="http://www.minervity.com/wp-content/uploads/2009/02/label-layout.jpg" alt="Label Layout" width="335" height="355" /></p>
<h2>Step 9</h2>
<p>That&#8217;s almost everything as far as our application. The only thing we need to do right now is to add the &#8220;shine&#8221; layer to it to create that extra depth to the count-up. Once again add the Shine image (which is a semi transparent layer saved as a PNG in Photoshop) by Importing it to the stage on the first frame of the &#8220;shine&#8221; layer. After doing this, if it&#8217;s not aligned already, align it by using the &#8220;Align X&#8221; commands found on your right in the Flash workspace.</p>
<p>Now we have something looking like this:</p>
<p><img class="aligncenter size-full wp-image-814" title="Shine Layer" src="http://www.minervity.com/wp-content/uploads/2009/02/shine-layer.jpg" alt="Shine Layer" width="335" height="355" /></p>
<h2>Step 10</h2>
<p>Well, what do you know. Our count-up is done and what we need to do right now is to save it and publish it. So go ahead and save your newly created online application. Name it &#8220;Live Count-Up&#8221;. After saving it open up &#8220;Publish Settings&#8230;&#8221; and make sure that ActionScript is set to ActionScript2.0 and that JPEG quality is set to 100. Now go ahead and publish your new application. All your new files are now in the same folder and it&#8217;s time to dig through the HTML to find the flash object tags so we can add them to your site.</p>
<h2>Step 11</h2>
<p>Upload your new application flash movie to a directory of your choice on your server host, but make sure you remember the path to it. The shorter the better. The file you should upload is &#8220;Live Count-Up.swf&#8221;.</p>
<h2>Step 12</h2>
<p>After uploading your file to your server the only thing we need to do right now is to incorporate the object code to your website/blog. This is the code you should use. Place it anywhere on your web site&#8217;s html code and bang, there it is!</p>
<blockquote><p>&lt;object classid=&#8221;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0&#8243; width=&#8221;200&#8243; height=&#8221;38&#8243; id=&#8221;Live Count-Up&#8221; align=&#8221;middle&#8221;&gt;</p>
<p>&lt;param name=&#8221;allowScriptAccess&#8221; value=&#8221;sameDomain&#8221; /&gt;</p>
<p>&lt;param name=&#8221;allowFullScreen&#8221; value=&#8221;false&#8221; /&gt;</p>
<p>&lt;param name=&#8221;movie&#8221; value=&#8221;Live Count-Up.swf&#8221; /&gt;</p>
<p>&lt;param name=&#8221;quality&#8221; value=&#8221;high&#8221; /&gt;</p>
<p>&lt;param name=&#8221;bgcolor&#8221; value=&#8221;#000000&#8243; /&gt;</p>
<p>&lt;embed src=&#8221;Live Count-Up.swf&#8221; quality=&#8221;high&#8221; bgcolor=&#8221;#000000&#8243; width=&#8221;200&#8243; height=&#8221;38&#8243; name=&#8221;Live Count-Up&#8221; align=&#8221;middle&#8221; allowScriptAccess=&#8221;sameDomain&#8221; allowFullScreen=&#8221;false&#8221; type=&#8221;application/x-shockwave-flash&#8221; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; /&gt;<br />
&lt;/object&gt;</p></blockquote>
<p>This code is looking for the flash movie in the root directory. If you put it in another directory just use &#8220;directory\Live Count-Up.swf&#8221; and it should all good.</p>
<p>That should be pretty much it! Now go ahead and test your new count-up on your own site or blog or you can check out this example to see how it works:</p>
<p><object width="200" height="38" data="Live Count-Up.swf" type="application/x-shockwave-flash"><param name="name" value="Live Count-Up" /><param name="bgcolor" value="#000000" /><param name="align" value="middle" /><param name="src" value="Live Count-Up.swf" /><param name="allowfullscreen" value="false" /><param name="quality" value="high" /></object></p>
<h2>Round Up</h2>
<p>Well, all should be working now there are plenty of areas this could be used within. For example you could stick one of these onto each and every post you make if you want to be sure everyone knows exactly how long ago you posted your blog post. Or, why not combine my &#8220;<a title="Live Visitor Counter - Tutorial" href="http://www.minervity.com/?p=715" target="_blank">Live Visitor Counter</a>&#8221; with this one to showcase your hit count during a certain amount of time. Should be pretty cool to watch for anyone!</p>
<p>Whatever you use this for it&#8217;s only your imagination that sets the limit. You are welcome to use this technology in whatever way you see fit. But, make sure of one thing. Have fun with it!</p>
<p>I hope you have enjoyed this tutorial and that you will check out my other tutorials on this site. I would very much like to see you return for future tutorials as well. Leave a comment or send me an email. If you have any questions don&#8217;t hesitate to contact me (which reminds me, I haven&#8217;t set up my contact page yet. Dang it! &#8211; 02/02/09).</p>
<p>It&#8217;s been great fun creating this tutorial and I hope I will hear from you soon!</p>
<p>Thank you!</p>
<img src="http://www.minervity.com/?ak_action=api_record_view&id=803&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-count-up/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>How To Create a &#8220;LIVE&#8221; Visitor Counter</title>
		<link>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-visitor-counter/</link>
		<comments>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-visitor-counter/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 18:26:32 +0000</pubDate>
		<dc:creator>Richard Darell</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Counter]]></category>
		<category><![CDATA[Explenation]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Live]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Settings]]></category>
		<category><![CDATA[Step By Step]]></category>
		<category><![CDATA[Tags]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Visitor]]></category>

		<guid isPermaLink="false">http://www.minervity.com/?p=715</guid>
		<description><![CDATA[Introduction
In this tutorial I will teach you how to create a &#8220;LIVE&#8221; visitor counter that actually updates itself. &#8220;LIVE&#8221; means that the counter, made in flash, checks for new visitors every 20 seconds or so ...]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-780" style="margin-right: 10px; margin-bottom:50px" title="Create A Live Visitor Counter - Article Title Image" src="http://www.minervity.com/wp-content/uploads/2009/01/calvc-article-image.jpg" alt="Create A Live Visitor Counter - Article Title Image" width="200" height="225" />Introduction</h2>
<p>In this tutorial I will teach you how to create a &#8220;LIVE&#8221; visitor counter that actually updates itself. &#8220;LIVE&#8221; means that the counter, made in flash, checks for new visitors every 20 seconds or so (this you will be able to set to whatever interval you think is best suited for your needs). A working example of this can be found on top of this website along with in the end of this tutorial.</p>
<p>The execution of this tutorial is very straight forward and doesn&#8217;t really demand any particular skills in either flash, photoshop, FTP or PHP other than the basic understanding of the three. There are however some important tasks that needs to be done in order for it to work properly. But I will guide you through the process best I can to ease your reading.</p>
<p>Creating this Live Visitor Counter I will be using the following software&#8217;s and Languages:</p>
<ul>
<li>Adobe Flash</li>
<li>Photoshop</li>
<li>PHP Scripting</li>
<li>FTP Client</li>
</ul>
<p>Alright that should be it. Let&#8217;s start off this tutorial!</p>
<h2>Step 1</h2>
<p>The first thing you need to do is to create a background for your counter (this is however optional and is just for effect). I decided to make a slightly bigger counter than the one I have on top of this site. The tutorial one measures 200*38 and has a red background.</p>
<p>What you would want to think about when creating this background is to give it some depth (again for effect). Doing this gives the counter a slighter more advanced look and more appealing to look at as well. The trick here is to create a second or more layers with for ex. a &#8220;shine&#8221; layer which you later put on top of your flash application in it&#8217;s own layer. This creates the illusion that there actually is some glass above the text itself.</p>
<p>Here is the final background in all it&#8217;s simplicity. As you can see there is a &#8220;shine&#8221; layer on it as well.</p>
<p style="text-align: center;"><img class="size-full wp-image-717 aligncenter" title="Counter Background" src="http://www.minervity.com/wp-content/uploads/2009/01/counter-background-full.jpg" alt="Counter Background" width="200" height="38" /></p>
<p style="text-align: left;">Make sure you separate the two layers in Photoshop making them a JPG &#8220;background&#8221; file and a PNG &#8220;shine&#8221; file. For an in depth tutorial on how to create the Shiny Button look check my earlier tutorial: &#8220;<a title="Make A Shiny Button Tutorial" href="http://www.minervity.com/?page_id=5" target="_blank">Make A Shiny Button</a>&#8220;</p>
<h2>Step 2</h2>
<p>Now when we have our background we can go ahead and do the necessary assembly in Flash. Open up Flash and open up the &#8220;Document Properties&#8221; panel. Set the dimensions to 200 (width) and 38 (height). Also change the frame rate from 12 to 10 to give it an exact count in milliseconds. You can also change the background color to black (#000000) to make it easier to see on a white background if something is not aligned properly. Before clicking OK you can go ahead and change the Title of the project to &#8220;Live Visitor Counter. Click Ok.</p>
<p style="text-align: center;"><img class="size-full wp-image-720 aligncenter" title="Document Properties" src="http://www.minervity.com/wp-content/uploads/2009/01/document-properties.jpg" alt="Document Properties" width="382" height="349" /></p>
<p style="text-align: center;">
<p style="text-align: center;">
<h2 style="text-align: left;">Step 3</h2>
<p>Now, create four (4) new layers making the total five. Name them (from the bottom up) &#8220;background&#8221;, &#8220;visitor counter&#8221;, &#8220;labels&#8221;, &#8220;shine&#8221; and &#8220;actions&#8221;.</p>
<p><img class="aligncenter size-full wp-image-725" title="Layer Setup" src="http://www.minervity.com/wp-content/uploads/2009/01/layer-setup.jpg" alt="Layer Setup" width="382" height="349" /></p>
<h2>Step 4</h2>
<p>Now to some ActionScript. Make sure your &#8220;Publishing Settings&#8221; are set to use ActioScript 2.0 as this is how this is read. OK now, in the first frame of the &#8220;actions&#8221; layer open the &#8220;Actions&#8221; edit view and type:</p>
<blockquote><p><strong>this.loadVariables(&#8220;counter.php?num=&#8221;+random(999));</strong></p></blockquote>
<p>This will call for our PHP script that will handle the actual page view counting. We will deal with the PHP script after we&#8217;re done assembling our Flash movie.</p>
<h2>Step 5</h2>
<p>Create a second frame in the &#8220;actions&#8221; layer and open up the &#8220;Actions&#8221; edit view again. Type in:</p>
<blockquote><p><strong>this.loadVariables(&#8220;count.txt?num=&#8221;+random(999));</strong></p></blockquote>
<p>This will load the actual number of visitors from the holder file &#8220;count.txt&#8221; after our PHP script has done it&#8217;s job.</p>
<p>Now your layers should look something like this.</p>
<p><img class="aligncenter size-full wp-image-734" title="Actions Layout View" src="http://www.minervity.com/wp-content/uploads/2009/01/actions-layout.jpg" alt="Actions Layout View" width="382" height="349" /></p>
<h2>Step 6</h2>
<p>Now, let us go ahead and add the background that&#8217;s going to become our actual visitor counter. Import you background JPG in the first frame of the &#8220;background&#8221; layer. Make sure you align it to the top left corner so it covers the entire work area.</p>
<p>Also go ahead and add the shine to the counter by importing the shine PNG to the first frame of your &#8220;shine&#8221; layer. Don&#8217;t forget to align it just like you did with the background layer. To the top left corner. Your layout should now look something like this.</p>
<p><img class="aligncenter size-full wp-image-738" title="Counter Graphics - Assembled" src="http://www.minervity.com/wp-content/uploads/2009/01/counter-gfx-assembled.jpg" alt="Counter Graphics - Assembled" width="302" height="146" /></p>
<p>You can also go ahead locking these to layers to be sure nothing is moved ad throws off your alignment.</p>
<h2>Step 7</h2>
<p>Time to add some labels to make sure the visitor/viewer knows what this application is counting. In the first frame of the &#8220;labels&#8221; layer add these two labels to your counter application. &#8220;LIVE VISITOR COUNTER&#8221; in the top right corner and also &#8220;NUMBER OF VISITORS&#8221; in the bottom right corner. I have chosen to use the font &#8220;ARIAL&#8221; size 8 for the top label and &#8220;ARIAL&#8221; size 7 for the bottom one in order to be able to make a distinction of the two.</p>
<h2><img class="aligncenter size-full wp-image-741" title="Label Layout" src="http://www.minervity.com/wp-content/uploads/2009/01/labels-layout.jpg" alt="Label Layout" width="302" height="146" /></h2>
<h2>Step 8</h2>
<p>Here come the part where we actually incorporate the number count for our counter. It&#8217;s quite simple but there is some things you have to pay close attention to. In the &#8220;visitor counter&#8221; layer add a zero (0). Make the alignment of the text area &#8220;Align Right&#8221; to make sure the counter increases from right to left and nothing else. I have also chosen a bit grayer color for the number count to make the effect of the &#8220;shine&#8221; layer more eye pleasing. One important task here is not to forget to drag the text area all the way to the right to make sure that when the counter increases in muber of characters it doesn&#8217;t clip in the middle of the application. You should en up with something like this:</p>
<h2><img class="aligncenter size-full wp-image-744" title="Number Alignment &amp; Layout" src="http://www.minervity.com/wp-content/uploads/2009/01/number-layout.jpg" alt="Number Alignment &amp; Layout" width="302" height="146" /></h2>
<h2>Step 9</h2>
<p>With the number count text field still selected edit &#8220;count&#8221; in it&#8217;s VAR field in the text fields &#8220;Properties&#8221;. It&#8217;s case sensitive so make sure you edit &#8220;count&#8221; in only lower case character. What&#8217;s really important as well is to make sure you text field is &#8220;Dynamic Text&#8221; and not &#8220;Static Text&#8221; or &#8220;Input Text&#8221;. The counter simply won&#8217;t work if you forget this step.</p>
<p><img class="aligncenter size-full wp-image-745" title="Text Field Properties" src="http://www.minervity.com/wp-content/uploads/2009/01/text-field-properties.jpg" alt="Text Field Properties" width="537" height="155" /></p>
<h2>Step 10</h2>
<p>To make the entire application to update itself I have chosen the easiest way to accomplish this. When we chose 10 frames per second in the beginning of the tutorial we actually made sure that when we create more key frames the run time of the application is increased with one second per 10 frames. This makes it easy for us to choose whatever time interval we want the application to have. Let&#8217;s go ahead and add frames all the way up to 200 to make the application to update itself every 20 second.</p>
<p>You accomplish this easiest by going to the 200th frame, selecting it and pressing F5 for each layer and you have created yourself frames all the way up to 200.</p>
<p><img class="aligncenter size-full wp-image-748" title="Application Interval" src="http://www.minervity.com/wp-content/uploads/2009/01/application-interval.jpg" alt="Application Interval" width="537" height="155" /></p>
<p>As you can see I have locked all the layers to prevent any movement within the layers of the elements.</p>
<h2>Step 11</h2>
<p>We need the application to return to the first after running it&#8217;s entire cycle. Therefor, select the 200th frame of the &#8220;actions&#8221; layer and press F6. This will create a sole key frame at the 200th frame. With the frame still selected open up the Actions Edit view and insert the following code:</p>
<blockquote><p><strong>gotoAndPlay(2);</strong></p></blockquote>
<p>This will make the application to return to frame 2 of the flash movie. Now you might wonder &#8220;Why number 2?&#8221;. Well, the first frame increases the number by one every time it&#8217;s executed. If we were to return to the number 1 frame of the flash movie it would mean that every time it started over it would increase the counter number by 1. In this case we would get an application that increased it&#8217;s number every 20 seconds. Returning to number two ensures that we only increase it ones and after that we just pick up the current number of visitors. You should now have something like this:</p>
<p><img class="aligncenter size-full wp-image-751" title="Loop Actions Layout" src="http://www.minervity.com/wp-content/uploads/2009/01/loop-action-layout.jpg" alt="Loop Actions Layout" width="537" height="155" /></p>
<h2>Step 12</h2>
<p>Now go ahead and save your flash movie. After saving it go to &#8220;Publish Settings&#8230;&#8221; and make sure you&#8217;ve set your ActioScript to 2.0. Also, for best quality make sure you have the &#8220;BEST&#8221; quality selected and also the highest JPG quality. Here&#8217;s how my settings look:</p>
<p><img class="aligncenter size-full wp-image-754" title="Publish Settings" src="http://www.minervity.com/wp-content/uploads/2009/01/publish-settings.jpg" alt="Publish Settings" width="436" height="631" /></p>
<p>Go right ahead now and publish you flash movie by selecting &#8220;Publish&#8221; from the &#8220;File&#8221; menu. You can also press Shift+F12 to accomplish this. Make the name of your movie &#8220;Live Visitor Counter&#8221;.</p>
<h2>Step 13</h2>
<p>OK. We have out flash movie visitor counter application done. Now it&#8217;s time to look in to the PHP scrips need to make all this work. Open your choice of text editor. I prefer &#8220;Notes&#8221;  or &#8220;Type Pad&#8221; as it is a pretty easy word processor. With it open type this:</p>
<blockquote><p><strong>&lt;?php<br />
$count = file_get_contents(&#8220;count.txt&#8221;);<br />
$count = explode(&#8220;=&#8221;, $count);<br />
$count[1] = $count[1]+1;<br />
$file = fopen(&#8220;count.txt&#8221;, &#8220;w+&#8221;);<br />
fwrite($file, &#8220;count=&#8221;.$count[1]);<br />
fclose($file);<br />
print &#8220;count=&#8221;.$count[1];<br />
?&gt;</strong></p></blockquote>
<p>This script is the core of the counter so to speak. I will try and explain it as simply  as I can so you know what it does. But before doing this please save this as &#8220;<strong>counter.php</strong>&#8221; in the same directory as you flash movie.</p>
<p><span style="text-decoration: underline;"><em>Line 1:</em></span></p>
<blockquote><p><strong>&lt;?php</strong></p></blockquote>
<p>Opens up the php scripting channel declaring that this will be a php script.</p>
<p><span style="text-decoration: underline;"><em>Line 2:</em></span></p>
<blockquote><p><strong>$count = file_get_contents(&#8220;count.txt&#8221;);</strong></p></blockquote>
<p><strong></strong>This line loads the content of our (to be created) count file which is the current number of visitors before incresing it.</p>
<p><span style="text-decoration: underline;"><em>Line 3:</em></span></p>
<blockquote><p><strong>$count = explode(&#8220;=&#8221;, $count);</strong></p></blockquote>
<p>This line breaks down the count.txt file and just fetches the actual number of visitors.</p>
<p><span style="text-decoration: underline;"><em>Line 4:</em></span></p>
<blockquote><p><strong>$count[1] = $count[1]+1;</strong></p></blockquote>
<p>This line increase the number of visitors by 1.</p>
<p><span style="text-decoration: underline;"><em>Line 5:</em></span></p>
<blockquote><p><strong>$file = fopen(&#8220;count.txt&#8221;, &#8220;w+&#8221;); </strong></p></blockquote>
<p>This line &#8220;opens&#8221; the file for us to be able to write the new number back into the file.</p>
<p><span style="text-decoration: underline;"><em>Line 6:</em></span></p>
<blockquote><p><strong>fwrite($file, &#8220;count=&#8221;.$count[1]);</strong></p></blockquote>
<p>This line writes our new number into the file.</p>
<p><span style="text-decoration: underline;"><em>Line 7:</em></span></p>
<blockquote><p><strong>fclose($file);</strong></p></blockquote>
<p><strong></strong>This line closes the file. If we don&#8217;t close the file there will be a memory leakage further down the road as our script simply will open a new file again leaving the old still open.</p>
<p><span style="text-decoration: underline;"><em>Line 8:</em></span></p>
<blockquote><p><strong>print &#8220;count=&#8221;.$count[1];</strong></p></blockquote>
<p><strong></strong>This line pushes the new number of visitors to our variable &#8220;count&#8221; in our flash movie simply updating it.</p>
<p><span style="text-decoration: underline;"><em>Line 9:</em></span></p>
<blockquote><p><strong>?&gt;</strong></p></blockquote>
<p>This line simply close our script telling the computer the script has now ended.</p>
<h2>Step 14</h2>
<p>What we need to now is to create the actual file that holds the visitor number. This file will be loaded and increased every time someone enters your site (depending on where you put this flash movie of course). Open up your favorite text editor again and type in the following:</p>
<blockquote><p><strong>count=0</strong></p></blockquote>
<p>Save your file as &#8220;count.txt&#8221; in the same directory as your newly created flash file and your PHP script.</p>
<h2>Step 15</h2>
<p>Now we are done with all the background work. Now it&#8217;s time to put it in to your website. Upload &#8220;<strong>Live Visitor Counter.swf</strong>&#8220;, &#8220;<strong>counter.php</strong>&#8221; and &#8220;<strong>count.txt</strong>&#8221; to your root directory on your server. We need to do this as the counter executes it&#8217;s stuff from the root rather then a directory making the script a bit more complicated.</p>
<h2>Step 16</h2>
<p>Alright. To incorporate you newly created flash counter on your website/blog. Simply put this code wherever you feel you want it to be located on the site.</p>
<blockquote><p><strong>&lt;object classid=&#8221;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&#8243; codebase=&#8221;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0&#8243; width=&#8221;200&#8243; height=&#8221;38&#8243; id=&#8221;Live Visitor Counter&#8221; align=&#8221;middle&#8221;&gt;</strong></p>
<p><strong>&lt;param name=&#8221;allowScriptAccess&#8221; value=&#8221;sameDomain&#8221; /&gt;<br />
</strong></p>
<p><strong>&lt;param name=&#8221;allowFullScreen&#8221; value=&#8221;false&#8221; /&gt;<br />
</strong></p>
<p><strong>&lt;param name=&#8221;movie&#8221; value=&#8221;Live Visitor Counter.swf&#8221; /&gt;</strong></p>
<p><strong>&lt;param name=&#8221;quality&#8221; value=&#8221;best&#8221; /&gt;</strong></p>
<p><strong>&lt;param name=&#8221;bgcolor&#8221; value=&#8221;#000000&#8243; /&gt; </strong></p>
<p><strong>&lt;embed src=&#8221;Live Visitor Counter.swf&#8221; quality=&#8221;best&#8221; bgcolor=&#8221;#000000&#8243; width=&#8221;200&#8243; height=&#8221;38&#8243; name=&#8221;Live Visitor Counter&#8221; align=&#8221;middle&#8221; allowScriptAccess=&#8221;sameDomain&#8221; allowFullScreen=&#8221;false&#8221; type=&#8221;application/x-shockwave-flash&#8221; pluginspage=&#8221;http://www.macromedia.com/go/getflashplayer&#8221; /&gt;<br />
&lt;/object&gt;</strong></p></blockquote>
<p>That should be pretty much it. Now test your new live visitor counter to make sure all is in good order. Here is the finished counter as an example:</p>
<p><object width="200" height="38" data="Live Visitor Counter.swf" type="application/x-shockwave-flash"><param name="name" value="Live Visitor Counter" /><param name="bgcolor" value="#000000" /><param name="align" value="middle" /><param name="src" value="Live Visitor Counter.swf" /><param name="allowfullscreen" value="false" /><param name="quality" value="best" /></object></p>
<h2>Round Up</h2>
<p>Now when everything should be working you could simply sit and watch your counter and it will increase whitout reloading the page. Try open another browser and reload the page there. Quickly jump back to this page as you&#8217;ll sit it increase in a few seconds. Pretty cool huh!</p>
<p>Hope you have enjoyed this tutorial and that you will make good use of this technique. It can get quite mesmarizing at times to sit and watch it so don&#8217;t get addicted to it. LOL</p>
<p>If you have any additional question please don&#8217;t hesitate to ask. More tutorials coming up soon.</p>
<p>It&#8217;s been a pleasure creating this tutorial for you and I wish to see you back again and again!</p>
<p>Thank you!</p>
<img src="http://www.minervity.com/?ak_action=api_record_view&id=715&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.minervity.com/features/flash_tutorial/how-to-create-a-live-visitor-counter/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>
