<?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>Flash and ActionScript tutorials - flashadvanced &#187; ActionScript 3.0 Basics</title>
	<atom:link href="http://flashadvanced.com/category/actionscript-3-basics/feed/" rel="self" type="application/rss+xml" />
	<link>http://flashadvanced.com</link>
	<description>Become an advanced flash developer</description>
	<lastBuildDate>Mon, 11 Jan 2010 22:14:13 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Glowing Button Effect</title>
		<link>http://flashadvanced.com/actionscript-3-basics/glowing-button-effect/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/glowing-button-effect/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 13:44:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[animated buttons]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[glow filter]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=426</guid>
		<description><![CDATA[


In this quick tutorial I am going to show you how to create a nice glowing button effect using Flash and few lines of AS3 code in order to control the button. Let&#8217;s get started

1. Open a new Flash document and save it under &#8220;GlowingButton.fla&#8221;. Set the color to #000000 and the frame rate to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=426"><br />
<img src="http://flashadvanced.com/wp-content/upload/glowing/glowing.jpg" /><br />
</a></p>
<p>In this <strong>quick tutorial</strong> I am going to show you how to create a nice glowing button effect using Flash and few lines of AS3 code in order to control the button. Let&#8217;s get started</p>
<p><span id="more-426"></span></p>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;GlowingButton.fla&#8221;. Set the color to #000000 and the frame rate to 24 fps.</p>
<p><span style="color: #ff0000;">2.</span> Take the rectangle tool and from the properties panel set the values like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/glowing/properties.jpg" /></p>
<p>Choose #FFCC00 for color and draw a rectangle with size 120px wide by 30px high. Now take the Selection tool and select the half of the rectangle like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/glowing/selection.jpg" /></p>
<p>Change the color of the selected half to #FDD535. The button background is now ready. Nice effect, right?</p>
<p><span style="color: #ff0000;">3.</span> Select the whole rectangle and convert it to Movie Clip symbol. Type &#8220;golden_btn&#8221; for instance name. Now double click the movie clip to go inside its timeline. Once again, select the whole rectangle and convert it to Movie Clip symbol.</p>
<p><span style="color: #ff0000;">4.</span> Click on frame 20 and convert it to <strong>Keyframe</strong>. Now, on frame 20, select the movie clip, then open the Filters Panel and select the <strong>Glow</strong> filter like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/glowing/filter.jpg" /></p>
<p>For filter color choose #FFCC00.<br />
Now select a frame between frame 1 and 20 and create <strong>Motion Tween</strong>. From the properties panel set the tween <strong>easing</strong> to 100. Select the whole 20 frames and then by right clicking select Copy Frames:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/glowing/copy.jpg" /></p>
<p>Select frame <strong>21</strong> and by right clicking select Paste Frames.<br />
Now select the copied frames and again by right clicking select Reverse Frames.</p>
<p><span style="color: #ff0000;">5.</span> Create new layer called &#8220;text&#8221;. Take the text tool and type something. For font choose Tahoma, bold, size 18, color #990000. Convert the text field to movie clip. Click on frame 20 and convert it to Keyframe.<br />
When you are still on frame 20, select the text field movie clip, go to Properties Panel and under Color choose <strong>Tint</strong>. For color choose #000000:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/glowing/tint.jpg" /></p>
<p>Click somewhere between frame 1 and frame 20 and create Motion Tween. Repeat the step where you copy, paste and reverse the frames.</p>
<p><span style="color: #ff0000;">6.</span> Create a new layer called &#8220;actions&#8221; and convert frame 20 and 40 to Keyframes. On frames 1, 20, 40 open the actions panel and type &#8220;<strong>stop();</strong>&#8220;.</p>
<p>Our glowing button is ready! All we have to do is to go back to the main Scene and type some actionscript.</p>
<p><span style="color: #ff0000;">7.</span> On the main Scene, create a new layer called &#8220;actions&#8221; and open the Actions Panel.</p>
<pre><code>
//setting the button properties
golden_btn.mouseChildren = false;
golden_btn.buttonMode = true;

//adding event listeners to our button
golden_btn.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
golden_btn.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
golden_btn.addEventListener(MouseEvent.CLICK, mouseClickHandler);

function mouseOverHandler(e:MouseEvent):void{
	golden_btn.gotoAndPlay(2);
}

function mouseOutHandler(e:MouseEvent):void{
	golden_btn.gotoAndPlay(21);
}

function mouseClickHandler(e:MouseEvent):void{
	//navigating to URL on click
	navigateToURL(new URLRequest("http://flashadvanced.com"));
}
</pre>
<p></code></p>
<p>That's all!</p>
<h4>Here is the final result:</h4>
<p><object width="150" height="60"><param name="movie" value="http://flashadvanced.com/wp-content/upload/glowing/GlowingButton.swf"><embed src="http://flashadvanced.com/wp-content/upload/glowing/GlowingButton.swf" width="150" height="60"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/glowing/glowing.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/glowing-button-effect/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Gradient background color changer</title>
		<link>http://flashadvanced.com/actionscript-3-basics/gradient-background-color-changer/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/gradient-background-color-changer/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 18:07:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[ColorPicker]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gradient background]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=420</guid>
		<description><![CDATA[


In this tutorial you will learn how to use the AS3 Color Picker component to change the color of your gradient background. I will show you the technique of creating a nice gradient background

Note: In order to complete this tutorial you need to download TweenMax library. Do it by clicking here. Unzip the downloaded file [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=420"><br />
<img src="http://flashadvanced.com/wp-content/upload/cpicker/cpicker.jpg" /><br />
</a></p>
<p>In this tutorial you will learn how to use the <strong>AS3 Color Picker</strong> component to change the color of your gradient background. I will show you the technique of creating a <strong>nice gradient background</strong></p>
<p><span id="more-420"></span></p>
<h4>Note: In order to complete this tutorial you need to download TweenMax library. Do it by clicking <a href="http://blog.greensock.com/tweenmaxas3/">here</a>. Unzip the downloaded file in the same directory as the Flash files!</h4>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;ColorPicker.fla&#8221;. Set the size to 450 x 200 pixels.</p>
<p><span style="color: #ff0000;">2.</span> Take the rectangle tool, disable the stroke color, for fill color choose #999999 and then draw a rectangle with the same size as the document size. Convert the rectangle to movie clip and give it an instance name &#8220;bg&#8221;. Align the movie clip so it covers the stage.</p>
<p><span style="color: #ff0000;">3.</span> Create a new layer called &#8220;color picker&#8221;. Go to <strong>Window -> Components</strong> and drag a <strong>ColorPicker</strong> component to the stage. Give it instance name &#8220;cp&#8221;.</p>
<p><span style="color: #ff0000;">3.</span> Create a new layer called &#8220;gradient&#8221; and take the rectangle tool again. Disable the stroke color and draw a rectangle with size 450px by 200px. Position it so it covers the stage. Select the rectangle and go to the Color Panel by clicking Window -> Color. Under &#8220;type&#8221; choose &#8220;Radial&#8221;. For left color choose #E1E1E1 and set its alpha value to 25%. For right color choose #555555 and set its alpha value to 35%:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/cpicker/gradient.jpg" /></p>
<p>This is how you make <strong>gradient backgrounds</strong> in flash.</p>
<p><span style="color: #ff0000;">4.</span> Create a new layer called &#8220;actions&#8221; and open the Actions Panel.</p>
<pre><code>
//importing classes
import fl.events.ColorPickerEvent;
import flash.geom.ColorTransform;
import gs.*;

//getting the color info
var colorInfo:ColorTransform = bg.transform.colorTransform;

//adding an event listener for color change
cp.addEventListener (ColorPickerEvent.CHANGE, colorChanged);

function colorChanged (e:ColorPickerEvent):void {

	//setting the color of the ColorTransform object
	colorInfo.color = cp.selectedColor;

	//applying the color change animation with TweenMax
	TweenMax.to(bg, 1, {tint:cp.selectedColor});
}
</code></pre>
<p>This is the easiest way to create a nice gradient background color changer using Color Picker component and TweenMax. </p>
<h4>Here is the final result:</h4>
<p><object width="450" height="200"><param name="movie" value="http://flashadvanced.com/wp-content/upload/cpicker/ColorPicker.swf"><embed src="http://flashadvanced.com/wp-content/upload/cpicker/ColorPicker.swf" width="450" height="200"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/cpicker/ColorPicker.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/gradient-background-color-changer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colorful tabbed menu</title>
		<link>http://flashadvanced.com/actionscript-3-basics/colorful-tabbed-menu/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/colorful-tabbed-menu/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 18:00:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[tabbed menu]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[tint]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=354</guid>
		<description><![CDATA[


In this tutorial I will show you the easiest way to create a nice colorful menu with tabs using Flash and AS3.

1. Open a new Flash document and save it under &#8220;tabbedmenu.fla&#8221;. Set its size to 500 x 80 pixels.
2. Rename the first layer to &#8220;rectangle&#8221;. As you guessed, we&#8217;ll be drawing a rectangle. Take [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=354"><br />
<img src="http://flashadvanced.com/wp-content/upload/tabbedmenu/tabbedmenu.jpg" /><br />
</a></p>
<p>In this tutorial I will show you the easiest way to create a nice colorful menu with tabs using Flash and AS3.</p>
<p><span id="more-354"></span></p>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;tabbedmenu.fla&#8221;. Set its size to 500 x 80 pixels.</p>
<p><span style="color: #ff0000;">2.</span> Rename the first layer to &#8220;rectangle&#8221;. As you guessed, we&#8217;ll be drawing a rectangle. Take the rectangle tool, disable the stroke, for color select #1E73E6 and draw a rectangle with size 500 x 40 px and position it on the bottom center of the stage. Convert the rectangle to movie clip. Lock this layer. </p>
<p><span style="color: #ff0000;">3.</span> Create a new layer called &#8220;tabs&#8221; and take the rectangle tool again. Set its top corner values to 15:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/tabbedmenu/corners.jpg" /></p>
<p>Disable the stroke, select #1E73E6 for fill color and draw your tab. Your tab should be 96px wide by 33px high. Now take the text tool, select &#8220;Tahoma&#8221; for font, bold, size 18 and type &#8220;Home&#8221;. Convert both the tab and the text to Button symbol. Position the button like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/tabbedmenu/tabpos.jpg" /></p>
<p><span style="color: #ff0000;">4.</span> Now make 4 copies of the the button and position them one after another. To modify each of the buttons you need to select each of them and then go to Modify -> Symbol -> <strong>Duplicate Symbol</strong>. Now you can modify them. Go inside the first copy and change its color to #BF7AC7. Double click the text field and type &#8220;about&#8221;. For the second copy choose #6DB6F4 for color and type &#8220;portfolio&#8221;, for the third one &#8211; #97C57E for color and type &#8220;photos&#8221;, for the fourth one &#8211; #CD846B for color and type &#8220;contact&#8221;.<br />
Now give the buttons <strong>instance</strong> names: &#8220;home_btn&#8221;, &#8220;about_btn&#8221;, &#8220;pf_btn&#8221;, &#8220;photos_btn&#8221;, &#8220;contact_btn&#8221;. </p>
<p><span style="color: #ff0000;">5.</span> On the &#8220;tabs&#8221; layer, click on the first frame, go to Properties Panel and under &#8220;Frame&#8221; type &#8220;home_selected&#8221;:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/tabbedmenu/framename.jpg" /></p>
<p>Now click on frame 5, 10, 15, 20, convert them to keyframes and under &#8220;Frame&#8221; type:</p>
<p><strong>frame 5</strong>: &#8220;about_selected&#8221;<br />
<strong>frame 10</strong>: &#8220;portfolio_selected&#8221;<br />
<strong>frame 15</strong>: &#8220;photos_selected&#8221;<br />
<strong>frame 20</strong>: &#8220;contact_selected&#8221; </p>
<p><span style="color: #ff0000;">6.</span> Go back to &#8220;rectangle&#8221; layer and unlock it. Now click on frame 5, 10, 15, 20 and convert them to keyframes. Click on frame 5 and select the rectangle. Go to Properties Panel and under color select &#8220;Tint&#8221; and set it to 100%. Change the color to #BF7AC7:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/tabbedmenu/tint.jpg" /></p>
<p>Go to the other keyframes and do the same. On frame 10 set the &#8220;Tint&#8221; color to #6DB6F4, on frame 15 &#8211; #97C57E and on frame 20 &#8211; #CD846B. </p>
<p><span style="color: #ff0000;">7.</span> Create a new layer called actions and click on frame 5, 10, 15, 20 and convert them to keyframes. On frames 1, 5, 10, 15, 20 open the Actions Panel and type &#8220;stop();&#8221;.<br />
Go to the first frame again, open the Actions Panel and type the following block of code:</p>
<pre><code>
home_btn.addEventListener(MouseEvent.CLICK, homeSelected);
about_btn.addEventListener(MouseEvent.CLICK, aboutSelected);
pf_btn.addEventListener(MouseEvent.CLICK, portfolioSelected);
photos_btn.addEventListener(MouseEvent.CLICK, photosSelected);
contact_btn.addEventListener(MouseEvent.CLICK, contactSelected);

function homeSelected(e:MouseEvent):void{
	gotoAndPlay("home_selected");
}

function aboutSelected(e:MouseEvent):void{
	gotoAndPlay("about_selected");
}

function portfolioSelected(e:MouseEvent):void{
	gotoAndPlay("portfolio_selected");
}

function photosSelected(e:MouseEvent):void{
	gotoAndPlay("photos_selected");
}

function contactSelected(e:MouseEvent):void{
	gotoAndPlay("contact_selected");
}
</code></pre>
<h4>Here is the final result:</h4>
<p><object width="500" height="80"><param name="movie" value="http://flashadvanced.com/wp-content/upload/tabbedmenu/tabbedmenu.swf"><embed src="http://flashadvanced.com/wp-content/upload/tabbedmenu/tabbedmenu.swf" width="500" height="80"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/tabbedmenu/tabbedmenu.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/colorful-tabbed-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Flash CS3 components, Part 2</title>
		<link>http://flashadvanced.com/actionscript-3-basics/using-flash-cs3-components-part-2/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/using-flash-cs3-components-part-2/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 15:04:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[rotate]]></category>
		<category><![CDATA[scale]]></category>
		<category><![CDATA[slider]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=334</guid>
		<description><![CDATA[


Today I will show you how to create a nice flash application using the Slider component. This slider will be used to rotate and scale objects on the stage.

1. Open a new Flash document and save it under &#8220;slidercomponent.fla&#8221;. 
2. Rename the first layer to &#8220;figures&#8221; and draw a rectangle and a pentagon.
3. Convert the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=334"><br />
<img src="http://flashadvanced.com/wp-content/upload/components/comp2.jpg" /><br />
</a></p>
<p>Today I will show you how to create a nice flash <strong>application</strong> using the <strong>Slider</strong> component. This slider will be used to rotate and scale objects on the stage.</p>
<p><span id="more-334"></span></p>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;slidercomponent.fla&#8221;. </p>
<p><span style="color: #ff0000;">2.</span> Rename the first layer to &#8220;figures&#8221; and draw a rectangle and a pentagon.</p>
<p><span style="color: #ff0000;">3.</span> Convert the two figures to Movie Clips with registration points center. Give the rectangle instance name &#8220;rect&#8221; and the pentagon &#8211; &#8220;pent&#8221;.</p>
<p><span style="color: #ff0000;">4.</span> Create a new layer called &#8220;sliders&#8221;. Go to the Components by clicking Window -> Components. Drag two <strong>Slider components</strong> to the stage and position them under the figures. Give the first slider instance name &#8220;sliderrect&#8221; and the second &#8211; &#8220;sliderpent&#8221;.</p>
<p><span style="color: #ff0000;">5.</span> Create a new layer called &#8220;txt fields&#8221; and create two dynamic text fields and place them under the sliders. Give the first text field instance name &#8220;angle_txt&#8221; and the second &#8220;scale_txt&#8221;. Don&#8217;t forget to embed the font you use:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/components/embed.jpg /></p>
<p><span style="color: #ff0000;">6.</span> Now, create a new layer called &#8220;actions&#8221; and open the actions panel.</p>
<pre><code>
//importing SliderEvent class
import fl.events.SliderEvent;

//adding event listener to the first slider
sliderrect.addEventListener(SliderEvent.CHANGE, rotateObject);
//setting slider's maximum value to 100
sliderrect.maximum = 100;
/*boolean value that indicates whether the SliderEvent.CHANGE event
	is dispatched continuously as the user moves the slider thumb*/
sliderrect.liveDragging = true;
//adding event listener to the second slider
sliderpent.addEventListener(SliderEvent.CHANGE, scaleObject);
//setting slider minimum value to 1 because we don't want our object to disappear
sliderpent.minimum = 1;
//setting default slider thumb's position
sliderpent.value = 5;
sliderpent.liveDragging = true;

function rotateObject(e:SliderEvent):void{
	/*we create a variable that stores slider's value (from 0 to 100) multiplied by 3.6
		so that the variable returns values from 0 to 360*/
	var rotVal:int = (sliderrect.value)*3.6;
	//setting rectangle's rotation
	rect.rotation = rotVal;
	//rotation info
	angle_txt.text = rotVal.toString();
}

function scaleObject(e:SliderEvent):void{
	//dividing event target value by 5 because we don't want too big figures
	pent.scaleX = e.target.value / 5;
	pent.scaleY = e.target.value / 5;
	//scale info
	scale_txt.text = (e.target.value / 5).toString();
}
</code></pre>
<p>That was all!</p>
<h4>Here is the final result:</h4>
<p><object width="400" height="220"><param name="movie" value="http://flashadvanced.com/wp-content/upload/components/slidercomponent.swf"><embed src="http://flashadvanced.com/wp-content/upload/components/slidercomponent.swf" width="400" height="220"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/components/slidercomponent.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/using-flash-cs3-components-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Random color transform with AS3</title>
		<link>http://flashadvanced.com/actionscript-3-basics/random-color-transform-with-as3/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/random-color-transform-with-as3/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 01:26:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[colorTransform]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[random color]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=320</guid>
		<description><![CDATA[


In this quick tutorial I will show you how to change the color of a Movie Clip using the Color Transform class and Math.random.

1. Open a new Flash CS3 document with size 400 x 100.
2. Create your logo on the stage. I made the Flashadvanced logo. Give it an instance name &#8220;logo_mc&#8221;.
3. Create a new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=320"><br />
<img src="http://flashadvanced.com/wp-content/upload/cTransform/cTransform.jpg" /><br />
</a></p>
<p>In this <strong>quick</strong> tutorial I will show you how to change the color of a Movie Clip using the <strong>Color Transform</strong> class and <strong>Math.random</strong>.</p>
<p><span id="more-320"></span></p>
<p><span style="color: #ff0000;">1.</span> Open a new Flash CS3 document with size 400 x 100.<br />
<span style="color: #ff0000;">2.</span> Create your logo on the stage. I made the <strong>Flashadvanced</strong> logo. Give it an instance name &#8220;logo_mc&#8221;.<br />
<span style="color: #ff0000;">3.</span> Create a new layer called &#8220;button&#8221;. Take the rectangle tool and draw a rectangle for your button. Select it and convert it to Button symbol with instance name &#8220;change_btn&#8221;.<br />
<span style="color: #ff0000;">4.</span> Now we move to ActionScript:</p>
<pre><code>
//we import transform classes
import flash.geom.ColorTransform;
import flash.geom.Transform;

//variable for the color value
var col:uint;
//creating a color transform object
var cTransform:ColorTransform = transform.colorTransform;

//when clicking the button we change the color
change_btn.addEventListener(MouseEvent.CLICK, changeColor);

function changeColor(e:MouseEvent):void{
	//random color value
	col = Math.random()*0xffffff;
	cTransform.color = col;
	logo_mc.transform.colorTransform = cTransform;
}
</code></pre>
<p>That was quick and easy, right?</p>
<h4>This is the final result</h4>
<p><object width="400" height="100"><param name="movie" value="http://flashadvanced.com/wp-content/upload/cTransform/randomCol.swf"><embed src="http://flashadvanced.com/wp-content/upload/cTransform/randomCol.swf" width="400" height="100"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/cTransform/randomCol.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/random-color-transform-with-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash slideshow presentation</title>
		<link>http://flashadvanced.com/actionscript-3-basics/flash-slideshow-presentation/</link>
		<comments>http://flashadvanced.com/actionscript-3-basics/flash-slideshow-presentation/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 21:00:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript 3.0 Basics]]></category>
		<category><![CDATA[fade in]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[image animation]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=307</guid>
		<description><![CDATA[


In this tutorial I will show you how to create a nice image presentation using Flash CS3 and few lines of ActionScript 3 code. 

First of all download the images for the tutorial by clicking here.
1. Now open a new Flash CS3 document with size 420 x 340. Set the frame rate to 16 fps.
2. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=307"><br />
<img src="http://flashadvanced.com/wp-content/upload/slideshow/laptopslide.jpg" /><br />
</a></p>
<p>In this tutorial I will show you how to create a nice <strong>image presentation</strong> using Flash CS3 and few lines of ActionScript 3 code. </p>
<p><span id="more-307"></span></p>
<p>First of all download the images for the tutorial by clicking <a href="http://flashadvanced.com/wp-content/upload/slideshow/images.zip">here</a>.</p>
<p><span style="color: #ff0000;">1.</span> Now open a new Flash CS3 document with size 420 x 340. Set the frame rate to 16 fps.</p>
<p><span style="color: #ff0000;">2.</span> Import all of the downloaded images by clicking File -> Import -> Import to Library. Drag &#8220;laptop.jpg&#8221; to the stage and align it to center. Convert it to Movie Clip, give it instance name &#8220;slideshowMC&#8221; and after that go to the new created movie clip. Click on frame 135 and insert frame. Lock the layer.</p>
<p><span style="color: #ff0000;">3.</span> Create a new layer called &#8220;images&#8221;. Now, drag &#8220;pic1.jpg&#8221; to the stage and position it so that it covers the laptop&#8217;s screen. <strong>Break the image apart</strong> by selecting the image and then clicking Modify -> Break apart. Now, deselect the image and go to one of its corners.<br />
Drag the image corners so that they match the laptop&#8217;s screen. See the image below: </p>
<p><img src="http://flashadvanced.com/wp-content/upload/slideshow/laptopsteps.jpg" /></p>
<p>If you are ready, select the image and convert it to Movie Clip. Now, go to <strong>frame 30</strong> and convert it to keyframe. Go back to frame 1, select the image, go to Properties Panel and set the image <strong>alpha</strong> to 0%. Select a frame between 1 and 30 and create <strong>Motion Tween</strong>. Now, go to <strong>frame 35</strong>, convert it to keyframe, remove the image movie clip and drag the second image. Now repeat all previous steps. Do the same for the other images. Your timeline should look like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/slideshow/timeline.jpg" /></p>
<p><span style="color: #ff0000;">4.</span> Go to the main stage. Create a new layer called &#8220;buttons&#8221;. Take the rectangle tool and draw a &#8220;stop&#8221; button. Give it an instance name &#8220;stopBtn&#8221;. I made this one:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/slideshow/button.jpg" /></p>
<p>You can take the <strong>Transform tool</strong> and rotate the button a little bit so it matches the laptop. Select the button and go to Modify -> Symbol -> <strong>Duplicate symbol</strong> to create a Play button. Change the text to &#8220;play&#8221; and give the button instance name &#8220;playBtn&#8221;.</p>
<p><span style="color: #ff0000;">5.</span> Now we are ready to move to <strong>ActionScript</strong>. Create a new layer called &#8220;actions&#8221; and open the Actions panel.</p>
<pre><code>
//initially, we don't want to see Play button
playBtn.visible = false;
//positioning the buttons on the same X and Y values
stopBtn.x = playBtn.x;
stopBtn.y = playBtn.y;

//adding event listeners to the buttons
stopBtn.addEventListener(MouseEvent.CLICK, slideshowStop);
playBtn.addEventListener(MouseEvent.CLICK, slideshowPlay);

function slideshowStop(e:MouseEvent):void{
	//when clicking on stop button we stop the slideshow
	slideshowMC.gotoAndStop(1);
	//we hide stop button and show play button
	stopBtn.visible = false;
	playBtn.visible = true;
}

function slideshowPlay(e:MouseEvent):void{
	//when clicking on play button we stopplay the slideshow again
	slideshowMC.gotoAndPlay(2);
	//we hide the play button and show stop button again
	playBtn.visible = false;
	stopBtn.visible = true;
}
</code></pre>
<p>We are ready. I hope you liked it!</p>
<h4>Now let&#8217;s see the final result</h4>
<p><object width="420" height="340"><param name="movie" value="http://flashadvanced.com/wp-content/upload/slideshow/laptopslide.swf"><embed src="http://flashadvanced.com/wp-content/upload/slideshow/laptopslide.swf" width="420" height="340"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/slideshow/slideshow.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/actionscript-3-basics/flash-slideshow-presentation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
