<?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>Pink and Ain&#039;t &#187; Actionscript</title>
	<atom:link href="http://blog.pinkandaint.com/category/programming/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pinkandaint.com</link>
	<description>Animation, Flash, and other nerdy ramblings</description>
	<lastBuildDate>Mon, 28 Nov 2011 08:44:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dynamic Mask Symbol</title>
		<link>http://blog.pinkandaint.com/dynamic-mask-symbol/</link>
		<comments>http://blog.pinkandaint.com/dynamic-mask-symbol/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 01:02:34 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash Tools]]></category>
		<category><![CDATA[Foster's Home for Imaginary Friends]]></category>
		<category><![CDATA[Job Search]]></category>

		<guid isPermaLink="false">http://blog.pinkandaint.com/dynamic-mask-symbol/</guid>
		<description><![CDATA[If you’ve done any significant amount of animation in Flash then you’ve probably run into this problem. You want to give a symbol partial alpha, but that ends up giving you a big mess where each individual sub-symbol is alpha’d down, rather than just the symbol you’re actually working with. Blech! No Es Bueno I [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve done any significant amount of animation in Flash then you’ve probably run into this problem. You want to give a symbol partial alpha, but that ends up giving you a big mess where each individual sub-symbol is alpha’d down, rather than just the symbol you’re actually working with. Blech!</p>
<p>
<table border="0" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td valign="top" width="598"><a href="http://blog.pinkandaint.com/wp-content/uploads/image2.png" rel="shadowbox[sbpost-149];player=img;"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.pinkandaint.com/wp-content/uploads/image_thumb2.png" width="557" height="449" /></a></td>
</tr>
<tr>
<td valign="top" width="598">
<p align="center"><strong>No Es Bueno</strong></p>
</td>
</tr>
</tbody>
</table>
<p>I ran into this problem once again yesterday while working on my demo reel and I decided I’d had enough.&#160; I pulled out a trick I learned from <a href="http://mbambino.net/" onclick="pageTracker._trackPageview('/outgoing/mbambino.net/?referer=');">Mike Bambino</a> while I was working at Trilogy Studios.&#160; It turns out that if you do it dynamically (using Actionscript) then you can make a mask that supports semi-transparency.&#160; It lets you do awesome neato stuff like smooth gradient masks:</p>
<p>&#160;</p>
<p>
<table border="0" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td valign="top" width="600"><a href="http://blog.pinkandaint.com/wp-content/uploads/image3.png" rel="shadowbox[sbpost-149];player=img;"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.pinkandaint.com/wp-content/uploads/image_thumb3.png" width="544" height="445" /></a></td>
</tr>
<tr>
<td valign="top" width="600">
<p align="center"><strong>Awesome <em>and</em> Neato</strong></p>
</td>
</tr>
</tbody>
</table>
<p>What I wanted to do this time is to fade single characters in and out without affecting the other characters around them.&#160; Normally I’d do something with solid overlays to give the impression of a clean dissolve, but it wasn’t working this time.&#160; The characters were overlapping a bit, so the overlay would end up affecting both of them in an undesirable way.</p>
<p>To solve the problem I simply made a solid rectangular symbol with the relevant Actionscript in it.&#160; At run-time it gloms itself onto whatever movie clip is directly below it on the display list and says “hey you!&#160; I’m gonna be your mask now!”&#160; Then I simply fade the mask symbol on the timeline however I please in order to fade its maskee in and out.</p>
<p>Easy, huh?</p>
<p>Here’s the source code in case you’d like to apply it to your own stuff.&#160; Just put this on the first frame of your mask movie clip, then put the mask symbol directly above the thing you want to mask:</p>
<hr />
<pre>stop();
var maskee:DisplayObject;
<strong><font face="Verdana"></font></strong>
// Call the enter_frame function for the first frame
enter_frame(null);

function enter_frame(evt:Event)
{
	//trace(&quot;enter frame&quot;);

	var my_index:int = parent.getChildIndex(this);

	// Find the symbols just below this one
	maskee = parent.getChildAt(my_index - 1);

	// If there's something there, mask it.
	if(maskee)
	{
		// Cache as Bitmap must be turned on for both the mask and the maskee
		cacheAsBitmap = true;
		maskee.cacheAsBitmap = true;
		//trace(&quot;masking &quot; + maskee.name);
		maskee.mask = this;
	}
}

// Remove the reference to the mask if it gets removed from the stage
function removed_from_stage(evt:Event)
{
	maskee.mask = null;
	removeEventListener(Event.ENTER_FRAME, enter_frame)
	//trace(&quot;removed mask&quot;);
}

addEventListener(Event.REMOVED_FROM_STAGE, removed_from_stage);
addEventListener(Event.ENTER_FRAME, enter_frame)</pre>
<hr />
<p>And here’s a Flash file with it all set up and working, just to make it totally easy to see how it works:</p>
<p><a href="/wp-content/uploads/dynamic mask.fla">Dynamic mask.fla</a> (57KB)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pinkandaint.com/dynamic-mask-symbol/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apple is wandering in the direction of Lawful Evil</title>
		<link>http://blog.pinkandaint.com/apple-is-wandering-in-the-direction-of-lawful-evil/</link>
		<comments>http://blog.pinkandaint.com/apple-is-wandering-in-the-direction-of-lawful-evil/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:28:13 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://blog.pinkandaint.com/apple-is-wandering-in-the-direction-of-lawful-evil/</guid>
		<description><![CDATA[Some of you may have heard about the kerfuffle in the last few days between Apple and Adobe. Briefly, Apple made a change to their developer agreement that makes it against the rules to use any language other than C, C++, Objective C, or Javascript when making applications for the iPhone/iPod/iPad. Furthermore, they&#8217;ve disallowed abstraction [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you may have heard about the kerfuffle in the last few days between Apple and Adobe.  Briefly, Apple made a change to their developer agreement that makes it against the rules to use any language other than C, C++, Objective C, or Javascript when making applications for the iPhone/iPod/iPad.  Furthermore, they&#8217;ve disallowed abstraction or compatibility libraries.  The practical upshot of this is that Adobe&#8217;s most-touted feature in its new version of Flash, the ability to compile directly to an iPhone, is now pretty much worthless.  Have no doubt, this was a change directed firmly at Adobe, and it encroaches into the region of Evil and perhaps Monopolistic.  <a href="http://theflashblog.com/?p=1888" onclick="pageTracker._trackPageview('/outgoing/theflashblog.com/?p=1888&amp;referer=');">This post</a> at the Flash Blog pretty much sums up my feelings.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pinkandaint.com/apple-is-wandering-in-the-direction-of-lawful-evil/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

