<?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, Flex and ActionScript tutorials - flashadvanced &#187; flash</title>
	<atom:link href="http://flashadvanced.com/tag/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://flashadvanced.com</link>
	<description>Become an advanced actionscript developer</description>
	<lastBuildDate>Sun, 30 Jan 2011 21:10:20 +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/glowing-button-effect/</link>
		<comments>http://flashadvanced.com/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 [...]]]></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/glowing-button-effect/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Gradient background color changer</title>
		<link>http://flashadvanced.com/gradient-background-color-changer/</link>
		<comments>http://flashadvanced.com/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 [...]]]></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/gradient-background-color-changer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3 Currency Converter</title>
		<link>http://flashadvanced.com/as3-currency-converter/</link>
		<comments>http://flashadvanced.com/as3-currency-converter/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 14:16:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Advanced ActionScript 3]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[currency converter]]></category>
		<category><![CDATA[DataProvider]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[list component]]></category>
		<category><![CDATA[TextInput]]></category>

		<guid isPermaLink="false">http://flashadvanced.com/?p=410</guid>
		<description><![CDATA[In this tutorial I will show you how to create a Currency Converter using ActionScript 3 and Flash Components. The calculations are made in runtime, no button clicks needed! 1. Open a new Flash document and save it under &#8220;CurrencyConverter.fla&#8221;. Set the document size to 400 x 250 pixels and for color choose #CCCCCC. 2. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://flashadvanced.com/?p=410"><br />
<img src="http://flashadvanced.com/wp-content/upload/converter/converter.jpg" /><br />
</a></p>
<p>In this tutorial I will show you how to create a Currency Converter using ActionScript 3 and Flash Components. The calculations are made in runtime, <strong>no button clicks needed</strong>!</p>
<p><span id="more-410"></span></p>
<p><span style="color: #ff0000;">1.</span> Open a new Flash document and save it under &#8220;CurrencyConverter.fla&#8221;. Set the document size to 400 x 250 pixels and for color choose #CCCCCC.</p>
<p><span style="color: #ff0000;">2.</span> Open the Components Panel by clicking Window -> Copmponents and drag two <strong>List Components</strong>. Make them 145px wide by 100px high. Give the first List component instance name &#8220;fromList&#8221; and the second &#8220;toList&#8221;.</p>
<p><span style="color: #ff0000;">3.</span> Go to the Components Panel again and drag a <strong>TextInput</strong> component. For instance name type &#8220;input_txt&#8221;. Position the TextInput somewhere over the first List component.</p>
<p><span style="color: #ff0000;">4.</span> Take the <strong>Text Tool</strong> and create a dynamic text field somewhere over the second List component. Give the text field instance name &#8220;result_txt&#8221;. Set its properties like this:</p>
<p><img src="http://flashadvanced.com/wp-content/upload/converter/text.jpg" /></p>
<p>I think you got the idea. The user types the amount in the TextInput and selects the currency that he would like to convert from. The result appears in the &#8220;result_txt&#8221; text field.</p>
<p><img src="http://flashadvanced.com/wp-content/upload/converter/structure.jpg" /></p>
<p><span style="color: #ff0000;">5.</span> We are now ready and have to go to ActionScript. Create a new layer called &#8220;actions&#8221; and open the Actions Panel.</p>
<pre><code>
//importing DataProvider class
import fl.data.DataProvider;

//creating a new data provider object
var dp:DataProvider = new DataProvider();
//first we create a variable to store the first value
var fromVal:Number;
//then we create a variable for the second value
var toVal:Number;
//here we store what the user inputs
var inputVal:Number
//the result value
var calculatedVal:Number;
//the user can enter only numbers in the TextInput
input_txt.restrict = "0-9";

//adding items to the Data Provider. The user sees the "label" property.
//For data we set the currency weight. US dollar has weight 1.
//The others are in proportion to US Dollar
dp.addItem( { label: "U.S. Dollars", data:1 });
dp.addItem( { label: "Australian Dollars", data: 0.832114 });
dp.addItem( { label: "Canada Dollars", data: 0.926215 } );
dp.addItem( { label: "Euro", data:1.42643 });
dp.addItem( { label: "United Kingdom Pounds", data:1.65151 });
dp.addItem( { label: "India Rupees", data:0.0207573 });
dp.addItem( { label: "Poland Zlotych", data:0.341955 });
dp.addItem( { label: "Russia Rubles", data:0.0325614 });
dp.addItem( { label: "Philippines Pesos", data:0.02079 });
dp.addItem( { label: "Bulgarian Leva", data:0.729733 });
dp.addItem( { label: "Brazil Reais", data:0.531719 });

//populating the lists
fromList.dataProvider = dp;
toList.dataProvider = dp;

//adding Event Change listeners to all of the components
fromList.addEventListener(Event.CHANGE, calculateResult);
toList.addEventListener(Event.CHANGE, calculateResult);
input_txt.addEventListener(Event.CHANGE, calculateResult);
//we set items that are set by default
fromList.selectedIndex = 0;
toList.selectedIndex = 3;

//initializing "fromVal" and "toVal"
fromVal = fromList.selectedItem.data;
toVal = toList.selectedItem.data;

function calculateResult(e:Event):void{
	fromVal = fromList.selectedItem.data;
	toVal = toList.selectedItem.data;
	//casting String to Number
	inputVal = Number(input_txt.text);
	//calculating the result
	calculatedVal = inputVal * (fromVal / toVal);
	//adding the result to the text field
	result_txt.text = calculatedVal.toString();
}
</pre>
<p></code></p>
<h4>Here is the final result:</h4>
<p><object width="400" height="250"><param name="movie" value="http://flashadvanced.com/wp-content/upload/converter/CurrencyConverter.swf"><embed src="http://flashadvanced.com/wp-content/upload/converter/CurrencyConverter.swf" width="400" height="250"></embed></object></p>
<p style="text-align: left; margin: 40px 40px 40px 0;"><a href="http://www.flashadvanced.com/wp-content/upload/converter/converter.zip"><img src="http://flashadvanced.com/wp-content/upload/other/download.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://flashadvanced.com/as3-currency-converter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Colorful tabbed menu</title>
		<link>http://flashadvanced.com/colorful-tabbed-menu/</link>
		<comments>http://flashadvanced.com/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 [...]]]></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/colorful-tabbed-menu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Flash CS3 components, Part 2</title>
		<link>http://flashadvanced.com/using-flash-cs3-components-part-2/</link>
		<comments>http://flashadvanced.com/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. [...]]]></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/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/random-color-transform-with-as3/</link>
		<comments>http://flashadvanced.com/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. [...]]]></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/random-color-transform-with-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

