<?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 User &#187; transform</title>
	<atom:link href="http://www.flashuser.net/tag/transform/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flashuser.net</link>
	<description>Useful and daily inspiration resources from web design, css, wordpress, graphic design, photography, illustrator, photoshop.</description>
	<lastBuildDate>Tue, 07 Feb 2012 10:23:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tips &amp; Tricks 12: Change the color of a MovieClip using ColorTransform</title>
		<link>http://www.flashuser.net/flash-tricks/change-the-color-of-a-movieclip-using-colortransform.html</link>
		<comments>http://www.flashuser.net/flash-tricks/change-the-color-of-a-movieclip-using-colortransform.html#comments</comments>
		<pubDate>Sat, 31 Oct 2009 10:24:14 +0000</pubDate>
		<dc:creator>flashuser</dc:creator>
				<category><![CDATA[Flash Tips & Tricks]]></category>
		<category><![CDATA[Flash Tutorials]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://www.flashuser.net/?p=2783</guid>
		<description><![CDATA[If you ever wonder how to change the color of a MovieClip in Actionscript 3 here&#8217;s a very useful tip. All you have to do is use the ColorTranform class. There are many methods to be used, one that come in handy is the color property which I&#8217;ll show it to you. This property replace the old fashion Actionscript 2 setRGB() method. Here&#8217;s the code for changing the color of a MovieClip in AS2: where myMovie is an instance of a MovieClip. For Actionscript 3 the code isn&#8217;t so complicated and here it is: var newColor:ColorTransform = myMovie.transform.colorTransform; newColor.color = [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever wonder how to change the color of a MovieClip in Actionscript 3 here&#8217;s a very useful tip. All you have to do is use the ColorTranform class. There are many methods to be used, one that come in handy is the color property which I&#8217;ll show it to you.</p>
<p><span id="more-2783"></span></p>
<p>This property replace the old fashion Actionscript 2 setRGB() method. Here&#8217;s the code for changing the color of a MovieClip in AS2:</p>
<pre class="brush: as3; title: ; notranslate">
var myColor:Color = new Color(myMovie);
     myColor.setRGB(0x4455ff);
</pre>
<p>where <strong>myMovie</strong> is an instance of a MovieClip.</p>
<p>For Actionscript 3 the code isn&#8217;t so complicated and here it is:</p>
<p>var newColor:ColorTransform = myMovie.transform.colorTransform;<br />
     newColor.color = 0xFF5522;<br />
     myMovie.transform.colorTransform = newColor;</p>
<p>To see how the code works have a look at the example below:</p>
<div align="center" class="border-media">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_colorTransform_341355774"
			class="flashmovie"
			width="550"
			height="150">
	<param name="movie" value="http://www.flashuser.net/flash-files/flash_tips_tricks/colorTransform/colorTransform.swf " />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.flashuser.net/flash-files/flash_tips_tricks/colorTransform/colorTransform.swf "
			name="fm_colorTransform_341355774"
			width="550"
			height="150">
	<!--<![endif]-->
		<br />
 <!-- Begin Alternate Content --></p>
<p>
 <a href="http://adobe.com/go/getflashplayer"><br />
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /><br />
</a>
 </p>
<p><!-- End Alternate Content --></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
</div>
<p>The code for the example is here:</p>
<pre class="brush: as3; title: ; notranslate">
import flash.geom.ColorTransform;

square1.buttonMode = true;
square1.useHandCursor = true;
square1.mouseChildren = false;
square1.addEventListener(&quot;mouseOver&quot;, rollOverHandler);
square1.addEventListener(&quot;mouseOut&quot;, rollOutHandler);

square2.buttonMode = true;
square2.useHandCursor = true;
square2.mouseChildren = false;
square2.addEventListener(&quot;mouseOver&quot;, rollOverHandler);
square2.addEventListener(&quot;mouseOut&quot;, rollOutHandler);

function rollOverHandler(e:MouseEvent) {
	var newColor:ColorTransform = e.target.transform.colorTransform;
	if (e.target.name ==&quot;square1&quot;) {
		newColor.color = 0xFF5522;
	} else {
		newColor.color = 0x0066CC;
	}
	e.target.transform.colorTransform = newColor;

}

function rollOutHandler(e:MouseEvent) {
	var newColor:ColorTransform = e.target.transform.colorTransform;
	if (e.target.name ==&quot;square1&quot;) {
		newColor.color = 0x0066CC;
	} else {
		newColor.color = 0xFF5522;
	}
	e.target.transform.colorTransform = newColor;
}
</pre>
<div id="download-file"><a href="http://www.flashuser.net/flash-files/flash_tips_tricks/colorTransform/colorTransform.zip" color="FF0000" target="_blank"><span>Download the source file</span></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.flashuser.net/flash-tricks/change-the-color-of-a-movieclip-using-colortransform.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.flashuser.net @ 2012-02-07 05:55:32 -->
