<?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>Serge Jespers &#187; effects</title>
	<atom:link href="http://www.webkitchen.be/tag/effects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webkitchen.be</link>
	<description>Life as an Adobe platform evangelist</description>
	<lastBuildDate>Tue, 31 Jan 2012 17:35:39 +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>Tutorial: Sexy transitions with Flex 3 (as used in the MAX widget)</title>
		<link>http://www.webkitchen.be/2009/08/28/sexy-transitions-with-flex-3-as-used-in-the-max-widget/</link>
		<comments>http://www.webkitchen.be/2009/08/28/sexy-transitions-with-flex-3-as-used-in-the-max-widget/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 09:09:16 +0000</pubDate>
		<dc:creator>Serge Jespers</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-to]]></category>
		<category><![CDATA[adobe max]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[flex 3]]></category>
		<category><![CDATA[flex builder]]></category>
		<category><![CDATA[MAX2009]]></category>
		<category><![CDATA[maxwidget]]></category>
		<category><![CDATA[transitions]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.webkitchen.be/?p=1627</guid>
		<description><![CDATA[When I showed the first versions of the MAX widget to a few colleagues, most were very surprised to hear that this was all built with the Flex 3 framework and that no Flash Catalyst or Flash CS4 was involved in this. &#8220;Including the animations?&#8220;, was a question I got a lot. And yes&#8230; Even [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.webkitchen.be%2F2009%2F08%2F28%2Fsexy-transitions-with-flex-3-as-used-in-the-max-widget%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.webkitchen.be%2F2009%2F08%2F28%2Fsexy-transitions-with-flex-3-as-used-in-the-max-widget%2F&amp;source=sjespers&amp;style=normal&amp;service=bit.ly&amp;service_api=R_f11b21ad05448f9b4029b73b124e8d0e&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>When I showed the first versions of the <a href="http://max.adobe.com/widget" target="_blank">MAX widget</a> to a few colleagues, most were very surprised to hear that this was all built with the Flex 3 framework and that no Flash Catalyst or Flash CS4 was involved in this.</p>
<p>&#8220;<em>Including the animations?</em>&#8220;, was a question I got a lot. And yes&#8230; Even the animations are &#8220;programmed&#8221; using the Flex framework. And you know what&#8230; It&#8217;s really not as hard as it sounds. The Flex framework actually has a bunch of effects built in and they are really easy to use.</p>
<p>In this case, I used 2 move effects and specified a &#8220;Back.easeOut&#8221; easingFunction. This easing function creates that bouncing effect that you see in the widget.</p>
<pre>&lt;mx:Move id=&quot;moveIn&quot; yFrom=&quot;400&quot; duration=&quot;350&quot; easingFunction=&quot;Back.easeOut&quot;/&gt;
&lt;mx:Move id=&quot;moveOut&quot; yTo=&quot;400&quot; duration=&quot;250&quot; easingFunction=&quot;Back.easeIn&quot;/&gt;</pre>
<p>You can use these types of effects in a number of different ways but the easiest way (I think) is to specify the showEffect and hideEffect on a component.</p>
<pre>&lt;mx:Canvas id=&quot;page1_back&quot; showEffect=&quot;moveIn&quot; hideEffect=&quot;moveOut&quot; width=&quot;400&quot; height=&quot;400&quot;/&gt;</pre>
<p>When you set the visible property to false, the hideEffect will trigger and the showEffect gets triggered when you set the visible property to true. I&#8217;m sure you can already see how I built this ;-)</p>
<p>In the widget, you see 6 different pieces of graphics slide in to place over time. To do that, I created a timer that triggers my setup function over time.</p>
<pre>var setupTimer:Timer = new Timer(150, 3);
setupTimer.addEventListener(&quot;timer&quot;, doSetupPage1);
setupTimer.start();</pre>
<p>This timer will trigger the doSetupPage1 function 3 times with 150 milliseconds in between each call. All my doSetupPage1 function does, is set the visible property to true on the different pieces of graphics I want to show.</p>
<pre>
private function doSetupPage1(event:TimerEvent):void
{
    switch (event.target.currentCount)
    {
        case 1:
            page1_back.visible = true;
            break;
        case 2:
            page1_middle.visible = true;
            break
        case 3:
            page1_front.visible = true;
            break;
    }
}</pre>
<p>To hide them, I&#8217;m actually doing exactly the same thing. Instead of setting the visible property to true, I set it to false and when all pieces of artwork are hidden, I trigger the function that reveals the next page.</p>
<p align="center">[flash medium=5 w=400 h=400 mode=1]</p>
<p>To get you started, I created this little Flex project that demonstrates this approach. Now I&#8217;m not saying that this is best practice or not but I think it&#8217;s just an easy way to create sexy transitions with Flex 3.</p>
<p><a href="http://dl.getdropbox.com/u/117996/MAXWidget_HowTo_effects.zip" target="_blank"><img src="http://www.webkitchen.be/wp-content/uploads/2008/12/download_manager_72x72.png" alt="download_manager_72x72" title="download_manager_72x72" width="72" height="72" class="alignnone size-full wp-image-531" /></a></p>
<p><a href="http://dl.getdropbox.com/u/117996/MAXWidget_HowTo_effects.zip" target="_blank">Download the source.</a></p>
<iframe id="basic_facebook_social_plugins_likebutton" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.webkitchen.be%2F2009%2F08%2F28%2Fsexy-transitions-with-flex-3-as-used-in-the-max-widget%2F&amp;layout=standard&amp;show_faces=true&amp;width=500&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:500px; height:75px"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.webkitchen.be/2009/08/28/sexy-transitions-with-flex-3-as-used-in-the-max-widget/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

