<?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>zedia flash blog &#187; Animation</title>
	<atom:link href="http://www.zedia.net/tag/animation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zedia.net</link>
	<description>Flash, ActionScript, SEO and everything in between</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:58:56 +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>Introduction to TimelineLite / TimelineMax</title>
		<link>http://www.zedia.net/2009/introduction-to-timelinelite-timelinemax/</link>
		<comments>http://www.zedia.net/2009/introduction-to-timelinelite-timelinemax/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 04:00:59 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[TweenLite]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Timeline]]></category>
		<category><![CDATA[TimelineLite]]></category>
		<category><![CDATA[TimelineMax]]></category>

		<guid isPermaLink="false">http://www.zedia.net/?p=439</guid>
		<description><![CDATA[TimelineLite is a new library from the maker of TweenLite that enables you to group TweenLite instances (Tweens) to create the equivalent of the Flash Authoring Tool Timeline but in code. If you don&#8217;t know what TweenLite is head over to my tutorial on it first. What is it for The goal of this library [...]]]></description>
			<content:encoded><![CDATA[<p><a title="TimelineLite" href="http://blog.greensock.com/v11beta/" target="_blank">TimelineLite</a> is a new library from the maker of <a title="TweenLite" href="http://blog.greensock.com/tweenliteas3/" target="_blank">TweenLite</a> that enables you to group TweenLite instances (Tweens) to create the equivalent of the Flash Authoring Tool Timeline but in code. If you don&#8217;t know what TweenLite is head over to my <a title="TweenLite Tutorial Tween AS3" href="http://www.zedia.net/2008/actionscript-3-tweenlite-basic-tutorial/" target="_self">tutorial on it</a> first.</p>
<h3>What is it for</h3>
<p>The goal of this library is to give more power to the already powerful TweenLite library and to emulate some of the MovieClip&#8217;s functionalities. Once built, a TimelineLite instance will possess some methods that we&#8217;ve known for a long time: play(), stop(), gotoAndPlay(), etc. Three methods are used to create the timeline: append(), insert(), insertMultipple(). I prefer the insert method, it gives you more flexibility because you can set the time at which the Tween starts. The append() method will simply add your TweenLite instance at the end of the current timeline.</p>
<p>Here are some examples of how you would create a TimelineLite :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myTimeline:TimelineLite = <span style="color: #000000; font-weight: bold;">new</span> TimelineLite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//this will have 3 tween starting one after the one before is done</span>
myTimeline.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">1</span>, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">200</span>, y:<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
myTimeline.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//this one will have concurrent tweens a bit like layered tweens in the Flash Timeline</span>
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">1</span>, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">200</span>, y:<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">0.75</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>scaleX:<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">1.25</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Some of the cool stuff you can do with is that inside a TimelineLite you can insert other TimelineLite instances. Also you can add Labels and tween using TweenLite to those labels. You can tween the time of the timeline as well as the progress. Here are examples of what I just mentioned:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myTimeline:TimelineLite = <span style="color: #000000; font-weight: bold;">new</span> TimelineLite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">1</span>, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">200</span>, y:<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">0.75</span><span style="color: #66cc66;">&#41;</span>;
myTimeline.<span style="color: #0066CC;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TweenLite<span style="color: #66cc66;">&#40;</span>mc, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>scaleX:<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//Tween the timeline to any place in percent (from 0 to 1)</span>
TweenLite.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span>myTimeline, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span>progress:<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//Tween to a particular second in time (from 0 to the duration of the timeline)</span>
TweenLite.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span>myTimeline, <span style="color: #cc66cc;">0.5</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.75</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h3>Its advantages</h3>
<p>The major advantage that TimelineLite posesses over real timeline is the fact that it is dynamic. Meaning that you could make an function that takes a display object, that function would create an animation based on it and return a TimelineLite instance that you could use afterward. Then you could use that function to create the same animation on multiple display objects. Another example is that you could create animation based on what the user does, like you make him choose a number and you append that many instances on TweenLite in your TimelineLite (easy to do with traditionnal timeline too, but its just an example).</p>
<h3>Its Max conterpart</h3>
<p>As for the TweenLite library, TimelineLite has its Max equivalent, TimelineMax, which has more features like AS3 event listeners, repeat, repeatDelay, yoyo, addCallback(), removeCallback(), getActive(), etc.  Just to tell you how good this library is,  I have done a TimelineLite instance that tweened 25 display objects and 625 TweenLite instances and it worked perfectly fine, it wasn&#8217;t even slowing down.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2009/introduction-to-timelinelite-timelinemax/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>External Preloader; more complex cases</title>
		<link>http://www.zedia.net/2008/external-preloader-more-complex-cases/</link>
		<comments>http://www.zedia.net/2008/external-preloader-more-complex-cases/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 00:49:23 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[FlashVars]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[preloader]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/external-preloader-more-complex-cases/</guid>
		<description><![CDATA[In my previous post I spoke about what would be my optimal external preloader, but I really covered only simple examples. In relations to external preloaders, there are 2 cases where it gets more complex. First, when you want to time you preloader&#8217;s animation with your main content&#8217;s animation and second, when you use FlashVars [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post I spoke about what would be my <a title="Optimal External preloader in AS3" href="http://www.zedia.net/2008/the-right-way-to-do-a-preloader-in-as3/">optimal external preloader</a>, but I really covered only simple examples. In relations to external preloaders, there are 2 cases where it gets more complex. First, when you want to time you preloader&#8217;s animation with your main content&#8217;s animation and second, when you use FlashVars (variables passed from the HMTL to the SWF).</p>
<p><strong>Timing a preloader animation with the main content animation</strong></p>
<p>Sometimes you don&#8217;t want to start the loaded content as soon as it&#8217;s been loaded.  You want to leave time for the preloader&#8217;s exit animation to end or you want to morph your preloader with the main content to have some sort of continuity. In those cases, the external preloader has to call a method of the main content. That sounds simple but it actually isn&#8217;t. If you try to call a method directly like we used to do in ActionScript 2 the compiler will complain because it doesn&#8217;t know if the loaded content will have such a method. In order to solve this problem you will have to use interfaces. You can get more <a title="How to use Interfaces" href="http://www.zedia.net/2008/how-to-use-interface-in-actionscript-3/">information about interfaces on this previous post of mine</a>. Now that the loaded content is typed to an interface you will be able to call it&#8217;s method and the synchronization between the preloader and the content will be good.</p>
<p><strong>Using FlashVars</strong></p>
<p>FlashVars are really useful and a lot of times you might end up using them. The problem is that contrarily to ActionScript 2, in AS3 the root variable will refer to this SWF&#8217;s root, not to the entire application&#8217;s root. So from the loaded content you don&#8217;t have access to the FlashVars. You solve this problem the same way as we solved the preceding problem: by using an interface. In the first case, we mostly would have called a method without parameters like init() or something like that, but in this case the parameters will be the FlashVars. You might want to pass the root.loaderInfo.parameters.YOUR_VAR_NAME as a parameter or you might want to do some checking as to know if the parameter was passed or not. In your interface you will have to write down all the parameters you want to pass and what type (String, int, Number, etc) they are. Here is an example of how you could do it.</p>
<p>Here is the interface:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">zedia</span>.<span style="color: #006600;">interfaces</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IMain<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>flashvars1:<span style="color: #0066CC;">String</span>, flashvars2:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Here is some of the code of that the preloader could contain:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">zedia</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMain</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> mainContent:IMain;
<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">onLoadComplete</span><span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// this would be the function that the loader would call when the loading is completed</span>
  mainContent = IMain<span style="color: #66cc66;">&#40;</span>loader.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>;
  addChild<span style="color: #66cc66;">&#40;</span>Sprite<span style="color: #66cc66;">&#40;</span>mainContent<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
  mainContent.<span style="color: #006600;">init</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>root.<span style="color: #006600;">loaderInfo</span>.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">flashvars1</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#40;</span>root.<span style="color: #006600;">loaderInfo</span>.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">flashvars2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Here is some code of the loaded content:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package<span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">zedia</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMain</span>;
&nbsp;
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> Sprite <span style="color: #0066CC;">implements</span> IMain<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>flashvars1:<span style="color: #0066CC;">String</span>, flashvars2:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
      <span style="color: #808080; font-style: italic;">//do something with the FlashVars</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>As you can see in the preloader&#8217;s ActionScript, in order to add the content to the stage, you first have to cast it to Sprite. You will have to do this when you will want to have access to Sprite properties like x and y. I admit this is a down side of using interfaces but at the same time it solved both the problems of timing an animation and passing FlashVars to the loaded content.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/external-preloader-more-complex-cases/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Video tutorial on how to use GOASAP</title>
		<link>http://www.zedia.net/2008/video-tutorial-on-how-to-use-goasap/</link>
		<comments>http://www.zedia.net/2008/video-tutorial-on-how-to-use-goasap/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 03:39:29 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[GOASAP]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/video-tutorial-on-how-to-use-goasap/</guid>
		<description><![CDATA[I have talked a bit about GOASAP, but I didn&#8217;t really have the time to check it out; well mosessupposes made a good video tutorial on how to create your own animation engine. Be sure to check it out because it&#8217;s pretty good.]]></description>
			<content:encoded><![CDATA[<p>I have talked a bit about GOASAP, but I didn&#8217;t really have the time to check it out; well mosessupposes made a <a href="http://go.mosessupposes.com/?p=28" title="GOASAP video tutorial" target="_blank">good video tutorial on how to create your own animation engine</a>. Be sure to check it out because it&#8217;s pretty good.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/video-tutorial-on-how-to-use-goasap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TweenLite, Tweener, GOASAP &#124; Fun with animation packages</title>
		<link>http://www.zedia.net/2008/tweenlite-tweener-goasap-fun-with-animation-packages/</link>
		<comments>http://www.zedia.net/2008/tweenlite-tweener-goasap-fun-with-animation-packages/#comments</comments>
		<pubDate>Sat, 19 Jan 2008 01:06:57 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[GOASAP]]></category>
		<category><![CDATA[Tweener]]></category>
		<category><![CDATA[TweenLite]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2008/tweenlite-tweener-goasap-fun-with-animation-packages/</guid>
		<description><![CDATA[I have been speaking a lot about Tweener these days and for a good reason; it&#8217;s a really good as3 animation library. I can&#8217;t say I have been having trouble with it but I found evidence from different sources that it might not be the best animation package for what I want to do. What [...]]]></description>
			<content:encoded><![CDATA[<p>I have been speaking a lot about <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> these days and for a good reason; it&#8217;s a really good as3 animation library. I can&#8217;t say I have been having trouble with it but I found evidence from different sources that it might not be the best animation package for what I want to do.</p>
<p>What I am doing is mostly websites and in those website I use ActionScript to make everything move; I rarely use the timeline. All of my tweens are at most 1 second long but most of the time they last about 0.5 second. I liked <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> because it was way better than Adobe&#8217;s Tween classes but I found from 2 different sources (<a href="http://blog.greensock.com/tweening-speed-test/" title="Tween engine speed comparison" target="_blank">TweenLite</a>, <a href="http://www.goasap.org/info.html" title="Benchmark As3 Tween" target="_blank">GOASAP</a>) that <a href="http://blog.greensock.com/tweenliteas3" title="TweenLite" target="_blank">TweenLite</a> is faster for small tweens than <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>. You might know that already, but being fast is one of the most important attribute for me in a tweening engine. Not so much because I use too much animation at the same time but more because that when I start Tweens, I don&#8217;t want them to eat all of the cpu, I want them too leave as much processing power for other stuff like timeline animations, video etc. These is all to say that I am changing all my code from <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> to <a href="http://blog.greensock.com/tweenliteas3" title="TweenLite" target="_blank">Tweenlite</a> (that I had previously changed from Adobe Tween classes to <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>) because I need the extra speed badly.</p>
<p>Something came up since I started this project. From the maker of the <a href="http://www.mosessupposes.com/Fuse/" title="Fuse kit" target="_blank">Fuse kit</a> comes <a href="http://go.mosessupposes.com/" title="GO AS3 Animation Platform" target="_blank">GOASAP</a>. Which looks very promissing; it&#8217;s  not an animation package per say, it&#8217;s more like animation package building blocks. Since sometime there is a lot of overhead in animation engine for things that you will never use, <a href="http://www.mosessupposes.com/blog/" title="Moses Supposes" target="_blank">Moses Supposes</a> made us all animation library developers. The <a href="http://go.mosessupposes.com/" title="Go AS3 Animation Platform" target="_blank">GOASAP</a> code base is in AS3 and I can&#8217;t wait to start using it. In the mean time I invite you all to go and start developing your own animation code;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2008/tweenlite-tweener-goasap-fun-with-animation-packages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tweener and tweening colors</title>
		<link>http://www.zedia.net/2007/tweener-and-tweening-colors/</link>
		<comments>http://www.zedia.net/2007/tweener-and-tweening-colors/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 01:08:57 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Tweener]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Color]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/tweener-and-tweening-colors/</guid>
		<description><![CDATA[I did a previous post about the static method Color.interpolateColor, but at that time, I hadn&#8217;t really tried Tweener yet. Let me tell you this, tweening colors has never been easier than with Tweener. I&#8217;m am going to redo the same example showing you how simple it is to use Tweener instead of Color.interpolateColor form [...]]]></description>
			<content:encoded><![CDATA[<p>I did a <a href="http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/" title="Color.interpolateColor">previous post about the static method Color.interpolateColor</a>, but at that time, I hadn&#8217;t really tried <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> yet. Let me tell you this, tweening colors has never been easier than with <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>. I&#8217;m am going to redo the same example showing you how simple it is to use <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> instead of <a href="http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/" title="Color.interpolateColor">Color.interpolateColor form the fl.motion.Color package</a>. Here is the code, you just have to paste it on a frame an compile it to swf to make it work (you have to have the <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> classes in your folder or in one of the default class folder).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> simpleSprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">100</span>;
simpleSprite.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">100</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xff0000<span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">200</span>,<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>simpleSprite<span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
simpleSprite.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OVER</span>, makeBlue<span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, makeRed<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> makeBlue<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
  Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>simpleSprite, <span style="color: #66cc66;">&#123;</span>_color:0x0000ff, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">1</span>, transition:<span style="color: #ff0000;">&quot;easeOutQuart&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> makeRed<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
  Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>simpleSprite, <span style="color: #66cc66;">&#123;</span>_color:<span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">1</span>, transition:<span style="color: #ff0000;">&quot;easeOutQuart&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>That&#8217;s it. And it does exactly the same thing and probably faster than the Tween classes. Notice that it takes only one line of code to change the color instead of the <a href="http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/" title="Color.interpolateColor">more complex method I used previously</a> . Also you only have to import the <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> classes as opposed to six import statements.</p>
<p>Well that&#8217;s it for today, I&#8217;ll try and investigate on more <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> properties because it just keep surprising me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/tweener-and-tweening-colors/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Making a simple button using Tweener and Sprites in AS3</title>
		<link>http://www.zedia.net/2007/making-a-simple-button-using-tweener-and-sprites-in-as3/</link>
		<comments>http://www.zedia.net/2007/making-a-simple-button-using-tweener-and-sprites-in-as3/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 02:46:41 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Tweener]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/making-a-simple-button-using-tweener-and-sprites-in-as3/</guid>
		<description><![CDATA[In a previous tutorial, I showed how to make a simple button using the Tween classes and Sprites. I am going to redo the same tutorial but using Tweener instead. I am not going to re-explain the first step which are all the same than in the previous tutorial; I am just going to speak [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous tutorial, I showed how to make a <a href="http://www.zedia.net/making-a-simple-button-using-tweens-and-sprites-in-actionscript-3/" title="Simple button using Tween classes and Sprites" target="_blank">simple button using the Tween classes and Sprites</a>. I am going to redo the same tutorial but using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> instead. I am not going to re-explain the first step which are all the same than in the <a href="http://www.zedia.net/making-a-simple-button-using-tweens-and-sprites-in-actionscript-3/" title="Simple button using Tween classes and Sprites" target="_blank">previous tutorial</a>; I am just going to speak about the mouse handler functions.</p>
<p>So here is the new code using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package<span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
  <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
  <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
  <span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #66cc66;">*</span>;
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> simpleButton <span style="color: #0066CC;">extends</span> Sprite<span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> simpleButton<span style="color: #66cc66;">&#40;</span>newLabel:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
      myLabel.<span style="color: #0066CC;">text</span> = newLabel;
      myLabelOver.<span style="color: #0066CC;">text</span> = newLabel;
      myLabelOver.<span style="color: #006600;">alpha</span> = <span style="color: #cc66cc;">0</span>;
      buttonMode = <span style="color: #000000; font-weight: bold;">true</span>;
      mouseChildren = <span style="color: #000000; font-weight: bold;">false</span>;
      addEventListener<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OVER</span>, handleMouseOver<span style="color: #66cc66;">&#41;</span>;
      addEventListener<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, handleMouseOut<span style="color: #66cc66;">&#41;</span>;
      addEventListener<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, handleMouseUp<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleMouseOver<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">Over</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">myLabelOver</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">myLabel</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleMouseOut<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">Over</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">myLabelOver</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
      Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">myLabel</span>,<span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">0.5</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleMouseUp<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The major advantage of <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> in the case of a rollover and a rollout (like most buttons) is that you don&#8217;t have to keep track of previous Tweens in order to stop them. With the Tween classes, if you don&#8217;t do that, you&#8217;re going to end up with strange rollover behaviors.  Also, we had to check if the Tween  existed before trying to stop them which added extra code. <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> handles all that for us which is pretty practical. I spoke some times of the <a href="http://www.mosessupposes.com/Fuse/" title="The Fuse Kit" target="_blank">Fuse Kit</a>; it seems packed with a lot of options, but you can&#8217;t do simple rollovers with it; with <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> you can.</p>
<p>Well I&#8217;m about done with my tutorial on <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> but I think I&#8217;ll do one about using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> to Tween between two colors, just like <a href="http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/" title="Tutorial about Color.interpolateColor" target="_blank">Color.interpolateColor</a> static method.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/making-a-simple-button-using-tweener-and-sprites-in-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ActionScript 3 Tweener Basic Tutorial</title>
		<link>http://www.zedia.net/2007/actionscript-3-tweener-basic-tutorial/</link>
		<comments>http://www.zedia.net/2007/actionscript-3-tweener-basic-tutorial/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 22:31:47 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Tweener]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/actionscript-3-tweener-basic-tutorial/</guid>
		<description><![CDATA[On my previous tutorial about how to do Tweens  using ActionScript 3 I used the Tween classes from Adobe. At the time I didn&#8217;t know about Tweener and the Fuse Kit didn&#8217;t have a version in ActionScript 3. I have used Tweener a bit now and I can say that I am starting to like [...]]]></description>
			<content:encoded><![CDATA[<p>On my previous tutorial about how to do <a href="http://www.zedia.net/actionscript-3-tweens-tutorial/" title="ActionScript Tween Tutorial">Tweens  using ActionScript 3</a> I used the Tween classes from <a href="http://www.adobe.com" title="Adobe" target="_blank">Adobe</a>. At the time I didn&#8217;t know about <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> and the <a href="http://www.mosessupposes.com/Fuse/" title="The Fuse Kit" target="_blank">Fuse Kit</a> didn&#8217;t have a version in ActionScript 3. I have used <a href="http://osflash.org/tweener" title="http://osflash.org/tweener" target="_blank">Tweener</a> a bit now and I can say that I am starting to like it a lot.</p>
<p>On a side note, I am now using <a href="http://blog.greensock.com/tweenliteas3/" title="TweenLite" target="_blank">TweenLite</a> instead of Tweener; TweenLite execute faster and is smaller in size. Here is a <a href="http://www.zedia.net/2008/actionscript-3-tweenlite-basic-tutorial/" title="AS3 TweenLite tutorial">tutorial on TweenLite</a>.</p>
<p>For this tutorial I am going to do exactly what I did in the previous tutorial but this time I&#8217;ll use <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>. The first thing you have to do, as with the Tween classes, is import <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>, you do it in this way.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #66cc66;">*</span></pre></div></div>

<p><a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> as some easing classes in it but you can also use the easing classes from Flash. One good side of <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> is that it compile perfectly fine in Flex. Tween and easing classes don&#8217;t compile with Flex&#8230; A down side of Tweener is that it adds an additional 8k to your file (as opposed to 2k for Tween classes for a total of 10k).  Ok so now we are ready to go.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">300</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">3</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The &#8220;Tweener.addTween&#8221; part is how you add a Tween, that&#8217;s kinda obvious. &#8220;rectangle&#8221; is the name of the object you want to do a Tween on one of its property (or more). &#8220;x:300&#8243; is the final x position that rectangle will be at. &#8220;time:3&#8243; is the time it will take to get there and &#8220;transition:&#8217;linear&#8217;&#8221; is the easing to use. You see this is already easier to use and to read than the Tween classes. One major change is that you input the starting position of the property. I think this is a good thing since like 90% of the time I have been doing Tween, I want the Tween to start from the current position of the property and you can just set the property before doing the Tween anyway.</p>
<p>The next example was about doing multiple Tweens on the same object but on different properties here is how we did it with the Tween classes:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myTweenX:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #ff0000;">&quot;x&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">300</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> myTweenAlpha:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #ff0000;">&quot;alpha&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> myTweenAlpha:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #ff0000;">&quot;width&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>, rectangle.<span style="color: #0066CC;">width</span>, rectangle.<span style="color: #0066CC;">width</span> + <span style="color: #cc66cc;">300</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> myTweenAlpha:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #ff0000;">&quot;rotation&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">90</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Here is how you would do that with <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">300</span>,alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">width</span>:rectangle.<span style="color: #0066CC;">width</span> + <span style="color: #cc66cc;">300</span>, rotation:<span style="color: #cc66cc;">90</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">3</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>So in one line I did what it used to take me 4 and it easy pretty easy to understand.</p>
<p>Another thing that is really nice with <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> is that it as a delay property. If you want your Tween to start in 1 second you do it in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>rectangle, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">3</span>, delay:<span style="color: #cc66cc;">1</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This is practical when you want to do Tweens in sequence (one after the other). With the Tween classes you would do it in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myTweenX:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>bloc, <span style="color: #ff0000;">&quot;alpha&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
myTweenX.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TweenEvent.<span style="color: #006600;">MOTION_FINISH</span>, doNextTween<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> doNextTween<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:TweenEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> myTweenAlpha:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>bloc, <span style="color: #ff0000;">&quot;x&quot;</span>, None.<span style="color: #006600;">easeOut</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">300</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
  myTweenX.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>TweenEvent.<span style="color: #006600;">MOTION_FINISH</span>, doNextTween<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>With <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>bloc, <span style="color: #66cc66;">&#123;</span>alpha:<span style="color: #cc66cc;">1</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">3</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>bloc, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">300</span>, <span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;">3</span>, delay:<span style="color: #cc66cc;">3</span>, transition:<span style="color: #ff0000;">&quot;linear&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>As you can see you use way less code using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> and it tends to keep all your code for an animation together which will be easier to understand when you come back. Also I have seen some benchmark and <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> seems to be performing better than the Tween classes. So all in all I guess I am just going to ditch the Tween classes and start using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> from now on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/actionscript-3-tweener-basic-tutorial/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Using fl.* packages in Flex and more</title>
		<link>http://www.zedia.net/2007/using-fl-packages-in-flex-and-more/</link>
		<comments>http://www.zedia.net/2007/using-fl-packages-in-flex-and-more/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 02:28:52 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[Tweener]]></category>
		<category><![CDATA[Actionscrip 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Blitting]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Montreal Game Summit]]></category>
		<category><![CDATA[Samuel Asher Rivell]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/using-fl-packages-in-flex-and-more/</guid>
		<description><![CDATA[Slow days at work means I get to experiment and search the web for new ways to develop. I did a lot of research today on Flex until I stumbled on this presentation on the beedigital blog. It&#8217;s a very nice presentation on how to integrate Flash and Flex in your workflow. That&#8217;s exactly what [...]]]></description>
			<content:encoded><![CDATA[<p>Slow days at work means I get to experiment and search the web for new ways to develop. I did a lot of research today on Flex until I stumbled on this <a href="http://www.adobe.com/devnet/flex/articles/flex_flash_workflow.html" title="Flash CS3 and Flex 3 workflow, how to innovate" target="_blank">presentation</a> on the <a href="http://www.beedigital.net/blog/?p=1578" title="beedigital blog" target="_blank">beedigital blog</a>. It&#8217;s a very nice presentation on how to integrate Flash and Flex in your workflow. That&#8217;s exactly what I wanted. After see it I tried to do some test projects in Flex. Most of the time I do every thing in ActionScript so I thought this wouldn&#8217;t be too difficult. The trouble is that most of the time I also use the Tween and Easing classes from Flash. These classes come in the fl.* package and this package does not compile in Flex. I searched a bit how I could make these classes compile but I only found complicated methods of doing so. I tired also to use the Tween classes from Flex, but in order to use them you have also to include the Flex framework which adds 100k to your project. My simple solution to this problem; using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> for my tweens. <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> only adds 10k to a swf file compared to the fuse engine (which is not in AS3 yet). It&#8217;s not so bad, it&#8217;s only a 8k difference to the Flash Tween classes (2k). Also using it a bit, I might have misjudged <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> a bit because it works very well. I might in the future redo some example using <a href="http://osflash.org/tweener" title="Tweener" target="_blank">Tweener</a> instead of the Tween classes.</p>
<p>I went on the <a href="http://www.blog.rivello.org/" title="blog of Samuel Asher Rivell" target="_blank">blog of Samuel Asher Rivell</a>, the author of the presentation I spoke of earlier, and found some other interesting things. First there is the <a href="http://www.sijm.ca/en" title="Montreal Game Summit" target="_blank">Montreal Game Summit</a> that&#8217;s going to be held on November 27th and 28th. I live in Montreal so I&#8217;d be pretty happy to go there, at least on the first day. It has some interesting conferences about Flash that I&#8217;d like to see especially the one given by Samuel Asher Rivell on Advertgames.  The second nice thing I found on his blog is the <a href="http://www.blog.rivello.org/?p=94" title="Presentation on Blitting" target="_blank">powerpoint presentation</a> of one of the conference he gave on blitting. I had seen the technique some time on the web but never knowing what it was or how to do it. His presentation is a good introduction to it and I&#8217;d be really interested in hearing his speech about it. There might be more on blitting on this blog since it looks really promising.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/using-fl-packages-in-flex-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My new friend setTint</title>
		<link>http://www.zedia.net/2007/my-new-friend-settint/</link>
		<comments>http://www.zedia.net/2007/my-new-friend-settint/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 00:09:52 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[fl.motion.color]]></category>
		<category><![CDATA[interpolateColor]]></category>
		<category><![CDATA[setTint]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/my-new-friend-settint/</guid>
		<description><![CDATA[I played around today with a method named setTint from the fl.motion.Color class. At first I was a bit confused because this method doesn&#8217;t return anything contrarily to the interpolateColor method which returns a color in hexadecimal. You have to use setTint in this way: 1 2 3 4 5 import fl.motion.Color; import flash.geom.ColorTransform; var [...]]]></description>
			<content:encoded><![CDATA[<p>I played around today with a method named setTint from the fl.motion.Color class. At first I was a bit confused because this method doesn&#8217;t return anything contrarily to the interpolateColor method which returns a color in hexadecimal. You have to use setTint in this way:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">motion</span>.<span style="color: #0066CC;">Color</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">ColorTransform</span>;
<span style="color: #000000; font-weight: bold;">var</span> ct:<span style="color: #0066CC;">Color</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Color</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
ct.<span style="color: #006600;">setTint</span><span style="color: #66cc66;">&#40;</span>0xFF0000, <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span>;
mc.<span style="color: #006600;">transform</span>.<span style="color: #006600;">colorTransform</span> = ct;</pre></td></tr></table></div>

<p>With mc being the displayObject you want it applied on. setTint can be pretty useful for setting a tint on a bitmap and it can also be used with tweens in the same way I used the interpolateColor in a previous post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/my-new-friend-settint/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Tweening colors using Color.interpolateColor</title>
		<link>http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/</link>
		<comments>http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 01:43:17 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[fl.motion.color]]></category>
		<category><![CDATA[interpolateColor]]></category>

		<guid isPermaLink="false">http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/</guid>
		<description><![CDATA[I have been looking for a long time for a way to tween colors in Flash and while browsing around I came across the Color class and the interpolateColor method. I then wanted to see how it worked. It is not that obvious so here is the code: 1 2 3 4 5 6 7 [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking for a long time for a way to tween colors in Flash and while browsing around I came across the Color class and the interpolateColor method. I then wanted to see how it worked. It is not that obvious so here is the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">Tween</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">TweenEvent</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">easing</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">motion</span>.<span style="color: #0066CC;">Color</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">ColorTransform</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> simpleSprite:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">100</span>;
simpleSprite.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">100</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xff0000<span style="color: #66cc66;">&#41;</span>;
simpleSprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">200</span>,<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>simpleSprite<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Get access to the ColorTransform instance associated with our sprite.</span>
<span style="color: #000000; font-weight: bold;">var</span> colorInfo:ColorTransform = simpleSprite.<span style="color: #006600;">transform</span>.<span style="color: #006600;">colorTransform</span>;
<span style="color: #808080; font-style: italic;">// This function is called when the stage is clicked.</span>
<span style="color: #000000; font-weight: bold;">function</span> makeBlue<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> tempMovie:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">var</span> alphaOver:Tween = <span style="color: #000000; font-weight: bold;">new</span> Tween<span style="color: #66cc66;">&#40;</span>tempMovie, <span style="color: #ff0000;">&quot;alpha&quot;</span>, Strong.<span style="color: #006600;">easeOut</span>,<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
  alphaOver.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TweenEvent.<span style="color: #006600;">MOTION_CHANGE</span>, tweenToBlue<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> tweenToBlue<span style="color: #66cc66;">&#40;</span>event:TweenEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #808080; font-style: italic;">// apply the change to the display object</span>
  colorInfo.<span style="color: #0066CC;">color</span> = <span style="color: #0066CC;">Color</span>.<span style="color: #006600;">interpolateColor</span><span style="color: #66cc66;">&#40;</span>0xff0000, 0x003399, event.<span style="color: #0066CC;">position</span><span style="color: #66cc66;">&#41;</span>;
  simpleSprite.<span style="color: #006600;">transform</span>.<span style="color: #006600;">colorTransform</span> = colorInfo;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, makeBlue<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>The first block of code is to import all that is needed to do our Tweening. The two classes that are of importance are the fl.motion.Color and flash.geom.ColorTransform.</p>
<p>In the second block of code, I create the Sprite that I will do the tweening on and draw a red rectangle in it using the graphics.drawRect method.</p>
<p>After that, it&#8217;s the listening function to the mouse event CLICK on the stage. This function create a new Sprite that will never be displayed. Its sole purpose will be to use its properties to do our Tween. Then we create our Tween as we would normally and we add a listener for the MOTION_CHANGE event.</p>
<p>All the good stuff happens in the next function; tweenToBlue. It is here that we use the static method interpolateColor of the Color class. We use the event&#8217;s position to give us the place where the Tween is at. That is why in our Tween as to have the start parameter as to be 0 and the end parameter as to be 1. We than apply to colorTransform to our Sprite.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2007/tweening-colors-using-colorinterpolatecolor/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

