<?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>Stroep &#187; googlecode</title> <atom:link href="http://blog.stroep.nl/tag/googlecode/feed/" rel="self" type="application/rss+xml" /><link>http://blog.stroep.nl</link> <description>Just a collection of random works - Mark Knol</description> <lastBuildDate>Tue, 10 Jan 2012 20:09:53 +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>Flashflowfactory as SWC</title><link>http://blog.stroep.nl/2010/11/flashflowfactory-swc/</link> <comments>http://blog.stroep.nl/2010/11/flashflowfactory-swc/#comments</comments> <pubDate>Sat, 06 Nov 2010 12:17:50 +0000</pubDate> <dc:creator>Mark Knol</dc:creator> <category><![CDATA[actionscript]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[flashflowfactory]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[googlecode]]></category><guid isPermaLink="false">http://blog.stroep.nl/?p=1069</guid> <description><![CDATA[<img src="http://blog.stroep.nl/wp-content/flashflowfactory1.png" alt="" title="flashflowfactory" width="100" height="100" class="alignleft size-full wp-image-1023" />I am working very hard for the first release of flashflowfactory. There are lots of code tweaks and more improved <a href="http://code.google.com/p/stroep/wiki/FlashFlowFactory">documentation</a> already. More about the framework and some introductions can be found in <a href="/2010/10/introducing-flashflowfactory/">this earlier post</a>. Now I really want to make it easy for lots of people. I already got some helpful tips from users/testers. So I am collecting everything that is needed to make it as usable as possible. ]]></description> <content:encoded><![CDATA[<p><img src="http://blog.stroep.nl/wp-content/flashflowfactory1.png" alt="" title="flashflowfactory" width="100" height="100" class="alignleft size-full wp-image-1023" />I am working very hard for the first release of flashflowfactory. There are lots of code tweaks and more improved <a href="http://code.google.com/p/stroep/wiki/FlashFlowFactory">documentation</a> already. More about the framework and some introductions can be found in <a href="/2010/10/introducing-flashflowfactory/">this earlier post</a>. Now I really want to make it easy for lots of people. I already got some helpful tips from users/testers. So I am collecting everything that is needed to make it as usable as possible. I am working on demo projects and it is still alpha.</p><h2>Serving as SWC</h2><p>Nowadays every AS3 framework is being served as SWC. This makes it very easy to add it to any project. So I really needed to create this too <img src='http://blog.stroep.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> However I thought it was easy, but I stumbled to a little problem:</p><p>I am using TweenLite, but is is <a href="http://www.greensock.com/licensing/">not legal</a> to serve code from GreenSock/TweenLite on googlecode, because of the special license model. Now all the flashflowfactory transitions make use of TweenLite. So when I would like to create an SWC of the framework + the transitions, I must include TweenLite. So, and that is the only option, I need to serve the transitions as a separate package. This makes me think. I am using TweenLite because it is my favorite tweenengine. I could use another tween engine, with a MIT license. But then the users of the framework should fully switch to that engine, or include multiple tweenengines in their projects (which would be crazy). So the new plan is to create an SWC of the framework without any default transition. Then I will serve multiple packages with the default transitions ported to some famous tween-engines, so you could make a choice. If you want to use Tweenlite you should download the TweenLite pack etc.. I have created the packs for TweenLite, Tweener, gTween and eaze-tween.<br /> I thought this whole license-thing was a problem, but when I take a closer look; Now you can make use your own favorite tweenengine. I think more choice is better (in this case).</p><p><strong>Check it out now:</strong><br /> - <a href="http://flashflowfactory.stroep.nl/">flashflowfactory.stroep.nl</a><br /> - <a href="https://code.google.com/p/stroep/">Googlecode project</a><br /> - <a href="http://code.google.com/p/stroep/wiki/FlashFlowFactory">Documentation / Simple how-to</a></p><p><a href="http://blog.stroep.nl/?flattrss_redirect&amp;id=1069&amp;md5=0a3b04469d1e2c32caa915db2abbcad9" title="Flattr" target="_blank"><img src="http://blog.stroep.nl/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded> <wfw:commentRss>http://blog.stroep.nl/2010/11/flashflowfactory-swc/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>Chain Tween</title><link>http://blog.stroep.nl/2010/10/chain-tween/</link> <comments>http://blog.stroep.nl/2010/10/chain-tween/#comments</comments> <pubDate>Sat, 30 Oct 2010 08:13:56 +0000</pubDate> <dc:creator>Mark Knol</dc:creator> <category><![CDATA[actionscript]]></category> <category><![CDATA[Code snippets]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[chain]]></category> <category><![CDATA[googlecode]]></category><guid isPermaLink="false">http://blog.stroep.nl/?p=1043</guid> <description><![CDATA[<img src="http://blog.stroep.nl/wp-content/chain.jpg" alt="Chain" title="Chain" width="100" height="100" class="alignleft size-full wp-image-832">Previous year I was working on a little class called <a href="/2009/11/delayed-function-calling-chain/">Chain</a>. Now I was already working at a updated version which could animate too (see <a href="http://twitter.com/mknol/statuses/6142155230">this tweet</a> from last year). Basically it has become a small tween engine. You have to know there are much better tween engines, like TweenLite, Tweener, eaze tween, gtween etc.. So you don't need a new tween engine, and definitely not this one :) I just love to share some thoughts.]]></description> <content:encoded><![CDATA[<p><img src="http://blog.stroep.nl/wp-content/chain.jpg" alt="Chain" title="Chain" width="100" height="100" class="alignleft size-full wp-image-832">Previous year I was working on a little class called <a href="/2009/11/delayed-function-calling-chain/">Chain</a>. Chain is a delayed function-calling util class for AS3. Now I was already working at a updated version which could animate too (see <a href="http://twitter.com/mknol/statuses/6142155230">this tweet</a> from last year). Basically it has become a small tween engine. You have to know there are much better tween engines, like TweenLite, Tweener, eaze tween, gtween etc.. So you don&#8217;t need a new tween engine, and definitely not this one <img src='http://blog.stroep.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I just love to share some thoughts.</p><p>I just finished this to see how far I could come and where I have to deal with by creating such an engine. It is just fun to develop classes which will bring you to a higher level of coding, because I really want to become an actionscript sensai master or something. When starting the animation part, I was very inspired by <a href="http://philippe.elsass.me/2009/09/as3-designing-a-new-tween-library/">this post</a>, which has the same idea of combining jQuery-syntax-style with tweening, which I was already using in Chain.<br /> Making a class chainable is very easy, you just have to return the class instance on every public function, like this:</p><div class="bbCSH" style="font-family: monospace;"><span style="color: #0066CC;">package</span><br /> <span style="color: #66cc66;">&#123;</span><br /> &nbsp; <span style="color: #b1b100;">public</span> <span style="color: #000000; ">class</span> ExampleChain<br /> &nbsp; <span style="color: #66cc66;">&#123;</span><br /> &nbsp; &nbsp; <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ExampleChain<br /> &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;saying hi!&quot;</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">this</span>;<br /> &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br /> &nbsp; <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #66cc66;">&#125;</span><br /> &nbsp;</div><p> This already allows you to do this:<div class="bbCSH" style="font-family: monospace;"> <span style="color: #000000; ">var</span> chain:ExampleChain = <span style="color: #000000; ">new</span> ExampleChain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> chain.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> &nbsp;</div><p>I think this is very powerful and we should use more chaining.</p><p>Anyway, Chain was originally created to make delayed function calling. I wrapped code around this feature, so it is still usable like it was intended, only I improved some functions and added tweening. You can pass a complete handler to the play() function. And it is also possible to reverse the full chain, even with animation.</p><p>Here again, the original simple usage</p><div class="bbCSH" style="font-family: monospace;"> <span style="color: #000000; ">var</span> myChain:Chain = <span style="color: #000000; ">new</span> Chain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;<br /> myChain.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>one, <span style="color: #cc66cc;">2000</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; .<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>two, <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; .<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>three, <span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; .<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span>, onChainComplete<span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// play 3 times</span></p><p><span style="color: #808080; font-style: italic;">// some functions</span><br /> <span style="color: #000000; ">function</span> one<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;one&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> two<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;two&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> three<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;three&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> onChainComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <br /> &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;done.&quot;</span><span style="color: #66cc66;">&#41;</span>; <br /> &nbsp; &nbsp; myChain.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #808080; font-style: italic;">/* trace output:<br /> one two three one two three one two three done.<br /> */</span> <br /> &nbsp;</div><p>Animated chain example</p><div class="bbCSH" style="font-family: monospace;"> <span style="color: #000000; ">var</span> myChain:Chain = <span style="color: #000000; ">new</span> Chain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;<br /> myChain<br /> &nbsp; &nbsp;.<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span>myMc, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">300</span>,y:<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #cc66cc;">700</span>, Easing.<span style="color: #006600;">elasticInOut</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #006600;">wait</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span>myMc2, <span style="color: #66cc66;">&#123;</span>rotation:<span style="color: #cc66cc;">100</span>, alpha:<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #cc66cc;">500</span>, Easing.<span style="color: #006600;">quartIn</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #006600;">wait</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span>, onChainComplete<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// play 2 times</span></p><p><span style="color: #000000; ">function</span> onChainComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <br /> &nbsp; &nbsp;<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;done.&quot;</span><span style="color: #66cc66;">&#41;</span>;<br /> &nbsp; &nbsp; myChain.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> <span style="color: #66cc66;">&#125;</span><br /> &nbsp;</div><p>As you can see, you can still chain things, it animates multiple movieclips, and it can be played multiple times. It is very readable, which I really like. It works also in reversed order too, so you can reverse the full animation (pointless but cool)!</p><p>If you don&#8217;t want to animate, but instantly apply settings to a displayObject,<br /> you can use <em>apply(mc, {vars})</em>, of couse this equals <em>animate(mc,{vars},0)</em> but it is more elegant.</p><p>To control the Chain, you have can use:<br /> <em>stop()</em> Stop playing, use doContinue to play futher from current point<br /> <em>doContinue() </em> Continue playing after a stop<br /> <em>reset() </em> Reset indexes, start from first point. If reversed, start at last point</p><p>So how does it work? Well it is still based on the same old add() function. When you call the animate() function, internally, it is collecting the properties of the tween. Then it is calling the add() function, with a reference to a protected function <em>playTween()</em>, which is always the same. So when you play the chain, it just calling a local function every time, which handles the animation.</p><p>For now, I don&#8217;t have any special properties; no auto-alpha, no short-rotation, blurfilters or tinting etc. You can only animate properties of movieclips.</p><p>So how does tweening (animation over time) work? This is the formula I am using:</p><div class="bbCSH" style="font-family: monospace;"><span style="color: #0066CC;">_target</span><span style="color: #66cc66;">&#91;</span>property.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span> = property.<span style="color: #006600;">startValue</span> + <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>property.<span style="color: #006600;">endValue</span> &#8211; property.<span style="color: #006600;">startValue</span><span style="color: #66cc66;">&#41;</span> * _easeFunc<span style="color: #66cc66;">&#40;</span>currentTime &#8211; _startTime<span style="color: #66cc66;">&#41;</span> / _duration<span style="color: #66cc66;">&#41;</span>;</div><p>This needs a little explanation. For example: When you add {x:100} as object to Chain for animation, &#8220;<em>x</em>&#8221; is the <em>property.name</em>, and <em>100</em> is the <em>property.endValue</em>. I am also getting current &#8220;<em>x</em>&#8221; value of the displayobject (which should move); this is the <em>property.startvalue</em>. Imaging this is currently 75.<br /> If you would write down the values into the formula, it looks like this:</p><div class="bbCSH" style="font-family: monospace;">myMc<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;x&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">75</span> + <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span> &#8211; <span style="color: #cc66cc;">75</span><span style="color: #66cc66;">&#41;</span> * _easeFunc<span style="color: #66cc66;">&#40;</span>currentTime &#8211; _startTime<span style="color: #66cc66;">&#41;</span> / _duration<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div><p>Now, as you can see, this is more readable. The only thing that is still vague is the ease function. Now I have to say this was a bit hard for me to understand at the first time, but it became very clear when I did understand what is does. I have read the book &#8216;Making things move&#8217; from Keith Peters (aka bit-101), which is a great reference and eye opening book for programmatic animation, trigonometry and other cool stuff. There is a chapter where animation over time is explained, which was really helpful creating the tween engine, and this time calculation. Now the time calculating returns a ratio, which is needed for the easing functions. I also studied some famous other tween engines; most of them use basically the same formula. By the way, the easing equations are used from Robert Penner.</p><p>Now, I really wanted to reverse the animations too. After some headache, the solutions was very simple. The time calculation is a value between 0-1, so I did 1 minus the time ratio <img src='http://blog.stroep.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><div class="bbCSH" style="font-family: monospace;"><span style="color: #0066CC;">_target</span><span style="color: #66cc66;">&#91;</span>property.<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span> = property.<span style="color: #006600;">startValue</span> + <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>property.<span style="color: #006600;">endValue</span> &#8211; property.<span style="color: #006600;">startValue</span><span style="color: #66cc66;">&#41;</span> * _easeFunc<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span> &#8211; <span style="color: #66cc66;">&#40;</span>currentTime &#8211; _startTime<span style="color: #66cc66;">&#41;</span> / _duration<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div><p>Another problem I had to deal with was the fact that animating 1 thing at a time is very boring. So I invented the animateAsync(), which works almost exactly like the animate(), only you could pass the duration and the delay as separate values. So you can move a clip for 700 milliseconds, and call the next chained item after 75 milliseconds. To compare: when using the animate() function, if you move an item for 700 milliseconds, it will take 700 milliseconds when calling the next chained item. This could cause strange behaviors and isn&#8217;t easy to manage (especially when you want to wait till all animations are done), but I its a nice feature I think. Again, even the async&#8217;s can be played in reversed order.</p><div class="bbCSH" style="font-family: monospace;"> <span style="color: #000000; ">var</span> myChain:Chain = <span style="color: #000000; ">new</span> Chain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;<br /> myChain<br /> &nbsp; &nbsp;.<span style="color: #006600;">animateAsync</span><span style="color: #66cc66;">&#40;</span>myMc, <span style="color: #66cc66;">&#123;</span>x:<span style="color: #cc66cc;">300</span>,y:<span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #cc66cc;">700</span>, <span style="color: #cc66cc;">10</span>, Easing.<span style="color: #006600;">elasticInOut</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span>myMc2, <span style="color: #66cc66;">&#123;</span>rotation:<span style="color: #cc66cc;">100</span>, alpha:<span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #cc66cc;">500</span>, Easing.<span style="color: #006600;">quartIn</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #006600;">wait</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span><br /> &nbsp; &nbsp;.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span>, onChainComplete<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// play 2 times</span></p><p><span style="color: #000000; ">function</span> onChainComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <br /> &nbsp; &nbsp;<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;done.&quot;</span><span style="color: #66cc66;">&#41;</span>;<br /> &nbsp; &nbsp; myChain.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> <span style="color: #66cc66;">&#125;</span><br /> &nbsp;</div><p>To clear all references, you should call the myChain.destroy(); function. This clears the references to all added functions, and clears the internal tween list.</p><p>update 02/11/2010:<br /> - added show/hide/rotate function<br /> - added shortRotation option<br /> - added scale (no need to define scaleX and scaleY separately)<br /> - optimized chain; chain items are stored by duration inside dictionary to save lots instances (where duration is the same)<br /> - added Chain.create for fast creation of an instance<br /> - updated apply function (extra param; apply on start)<br /> - several coding style fixes<br /> - added destroyOnComplete to animate() function</p><p>So if you are interested in the code, you can find it inside my googlecode:<br /> <strong>&raquo; <a href="http://code.google.com/p/stroep/source/browse#svn%2Ftrunk%2Fflashsources%2Fchain%2Fnl%2Fstroep%2Fchain">Chain Tween sources</a></strong></p><p><a href="http://blog.stroep.nl/?flattrss_redirect&amp;id=1043&amp;md5=f663ad2802c382bb217cb5b6a30e08b3" title="Flattr" target="_blank"><img src="http://blog.stroep.nl/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded> <wfw:commentRss>http://blog.stroep.nl/2010/10/chain-tween/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Introducing flashflowfactory</title><link>http://blog.stroep.nl/2010/10/introducing-flashflowfactory/</link> <comments>http://blog.stroep.nl/2010/10/introducing-flashflowfactory/#comments</comments> <pubDate>Sat, 16 Oct 2010 13:35:09 +0000</pubDate> <dc:creator>Mark Knol</dc:creator> <category><![CDATA[actionscript]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[flashflowfactory]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[googlecode]]></category><guid isPermaLink="false">http://blog.stroep.nl/?p=1017</guid> <description><![CDATA[<img src="http://blog.stroep.nl/wp-content/flashflowfactory1.png" alt="" title="flashflowfactory" width="100" height="100" class="alignleft size-full wp-image-1023" />I am a bit proud to present you my first own framework. This mini-framework for actionscript 3 helps you to easily setup a flash website. flashflowfactory makes use of SWFAddress for deeplinking and TweenLite for transitions. ]]></description> <content:encoded><![CDATA[<p><img src="http://blog.stroep.nl/wp-content/flashflowfactory1.png" alt="" title="flashflowfactory" width="100" height="100" class="alignleft size-full wp-image-1023" />I am a bit proud to present you my first own framework: <a href="http://flashflowfactory.stroep.nl/"><strong>flashflowfactory</strong></a>.<br /> This mini-framework for actionscript 3 helps you to easily setup a flash website. flashflowfactory makes use of SWFAddress for deeplinking and TweenLite for transitions. When you need to create small/medium websites with deeplinking and basic transitions, flashflowfactory could help you develop faster. I mostly used it for custom projects like viral websites. The best of flashflowfactory is its simplicity (no need to learn hard design-patterns, it is really straight-forward if you know the basics). You don&#8217;t have to develop a page setup or start from scratch, but keep the freedom to build the site in your style.</p><p><strong>Check it out now:</strong><br /> - <a href="http://flashflowfactory.stroep.nl/">flashflowfactory.stroep.nl</a><br /> - <a href="https://code.google.com/p/stroep/">Googlecode project</a><br /> - <a href="http://code.google.com/p/stroep/wiki/FlashFlowFactory">Documentation / Simple how-to</a></p><p><strong>Features</strong><ul style='color:#C8C7B2;border-left:2px solid #FF275C;padding-left:15px;margin-left:15px'><li>Global page creation</li><li>Deeplinking made easy: it&#8217;s included and no need to worry about it anymore</li><li>Page class with transition settings and states</li><li>Transitions between pages</li><ul style='color:#C8C7B2'><li>Currently 4 transitions included</li><li>Creating your own transitions is possible. This keeps your freedom of expression and makes it usable for every custom project.</li></ul><li>Global page settings and these settings can be overrided on page level</li><ul style='color:#C8C7B2'><li>Transition in/out between page</li><li>Easing/time customizable</li><li>Alignment options</li></ul><li>Alternative navigation (button) system</li><ul style='color:#C8C7B2'><li>Really easy linking</li><li>Automatic states</li><li>Grouping aka easy active state</li></ul><li>Global Event system</li><ul style='color:#C8C7B2'><li>Listen to event from any point in your application</li></ul><li>Automatic Event removal system</li></ul><p><strong>Example setup code</strong></p><div class="bbCSH" style="font-family: monospace;"> <span style="color: #000000; ">var</span> pageFactory:PageFactory = <span style="color: #000000; ">new</span> PageFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> <span style="color: #808080; font-style: italic;">// add your pages here: url, classReference, title</span><br /> pageFactory.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;/home&quot;</span>, HomePageVC, <span style="color: #ff0000;">&quot;Welcome!&quot;</span> <span style="color: #66cc66;">&#41;</span>; <br /> pageFactory.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;/contact&quot;</span>, ContactPageVC, <span style="color: #ff0000;">&quot;Contact us&quot;</span> <span style="color: #66cc66;">&#41;</span>;<br /> pageFactory.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;/info&quot;</span>, InfoPageVC, <span style="color: #ff0000;">&quot;About us&quot;</span> <span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p><p><span style="color: #808080; font-style: italic;">// optional page name, which indicates where to start</span><br /> pageFactory.<span style="color: #006600;">defaultPageName</span> = <span style="color: #ff0000;">&quot;/home&quot;</span>;</p><p><span style="color: #808080; font-style: italic;">// add default page settings, can also be overridden from the Page class</span><br /> pageFactory.<span style="color: #006600;">defaultSettings</span> = <span style="color: #000000; ">new</span> PageSettings<span style="color: #66cc66;">&#40;</span> <br /> &nbsp; &nbsp; <span style="color: #000000; ">new</span> SlideTransition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, &nbsp; <span style="color: #808080; font-style: italic;">// transition (there are more transitions + you can easily create your own)</span><br /> &nbsp; &nbsp; Elastic.<span style="color: #006600;">easeOut</span>, &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// easing of the in-transition </span><br /> &nbsp; &nbsp; Strong.<span style="color: #006600;">easeIn</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// easing of the out-transition </span><br /> &nbsp; &nbsp; <span style="color: #cc66cc;">1</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// duration of the in-transition </span><br /> &nbsp; &nbsp; <span style="color: #cc66cc;">0.7</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// duration of the out-transition </span><br /> &nbsp; &nbsp; Alignment.<span style="color: #006600;">MIDDLE_CENTER</span>, <span style="color: #808080; font-style: italic;">// alignment of the page on the stage</span><br /> &nbsp; &nbsp; Alignment.<span style="color: #006600;">LEFT_TOP</span> &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// centerpoint position of the page</span><br /> <span style="color: #66cc66;">&#41;</span>;</p><p><span style="color: #808080; font-style: italic;">// add page holder to stage</span><br /> addChild<span style="color: #66cc66;">&#40;</span> pageFactory.<span style="color: #006600;">view</span> <span style="color: #66cc66;">&#41;</span>;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> <span style="color: #808080; font-style: italic;">// load first page</span><br /> pageFactory.<span style="color: #006600;">init</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /> &nbsp;</div><p>This is the first release. The framework is still under development, and I really need some feedback. Some example projects will follow soon.</p><p><a href="http://blog.stroep.nl/?flattrss_redirect&amp;id=1017&amp;md5=e71ceb0b1a3d7ba4fa8454c0eb64b158" title="Flattr" target="_blank"><img src="http://blog.stroep.nl/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded> <wfw:commentRss>http://blog.stroep.nl/2010/10/introducing-flashflowfactory/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Chain: Delayed function calling [updated]</title><link>http://blog.stroep.nl/2009/11/delayed-function-calling-chain/</link> <comments>http://blog.stroep.nl/2009/11/delayed-function-calling-chain/#comments</comments> <pubDate>Sat, 14 Nov 2009 12:00:36 +0000</pubDate> <dc:creator>Mark Knol</dc:creator> <category><![CDATA[actionscript]]></category> <category><![CDATA[Code snippets]]></category> <category><![CDATA[as3]]></category> <category><![CDATA[chain]]></category> <category><![CDATA[class]]></category> <category><![CDATA[googlecode]]></category><guid isPermaLink="false">http://blog.stroep.nl/?p=824</guid> <description><![CDATA[<img src="http://blog.stroep.nl/wp-content/chain.jpg" alt="Chain" title="Chain" width="100" height="100" class="alignleft size-full wp-image-832" />I created a useful util-class to make delayed function calling easy. You can make a chain of functions, by adding them with a delay in milliseconds. This chain can be executed multiple times, even in reversed order. ]]></description> <content:encoded><![CDATA[<p><img src="http://blog.stroep.nl/wp-content/chain.jpg" alt="Chain" title="Chain" width="100" height="100" class="alignleft size-full wp-image-832" />I created a useful util-class to make delayed function calling easy. You can make a chain of functions, by adding them with a delay in milliseconds. This chain can be executed multiple times, even in reversed order.</p><p>Let&#8217;s take a look at a simple example of Chain.<br clear="both"/><div class="bbCSH" style="font-family: monospace;"><span style="color: #000000; ">var</span> myChain:Chain = <span style="color: #000000; ">new</span> Chain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <br /> myChain.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">COMPLETE</span>, onComplete<span style="color: #66cc66;">&#41;</span>;<br /> myChain.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>one, <span style="color: #cc66cc;">2000</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>two, <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>three, <span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</p><p><span style="color: #000000; ">function</span> one<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;one&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> two<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;two&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> three<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;three&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><br /> <span style="color: #000000; ">function</span> onComplete<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;done.&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span></p><p><span style="color: #808080; font-style: italic;">/* trace output:<br /> one two three one two three done.<br /> */</span><br /> &nbsp;</div><p>What is happening here? At the first line we are instantiating the class, and the second line represents what chain does. There is a public function called &#8216;add&#8217;, which is an important part of the class. <em>add(one, 2000)</em> means: execute a function called &#8216;one&#8217; after 2000 milliseconds. <em>add(two,500).add(three,1000)</em> are functions that are called after one is finished, with other delays. You can create your own rhythm/sequence/pattern. At the end we see <em>play(2)</em>, which means: Execute the sequence of functions defined before, and repeat them 2 times. After that, dispatch event COMPLETE.</p><p>So that&#8217;s basically it. A cool part is you can play it reversed, using <em>playReversed()</em>. I am inspired by jQuery (which has nothing to do with this) to enable the ability to stick functions, but thats optional.</p><div class="bbCSH" style="font-family: monospace;"> myChain.<span style="color: #006600;">playReversed</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</p><p><span style="color: #808080; font-style: italic;">/* trace output:<br /> three two one three two one<br /> */</span><br /> &nbsp;</div><p>Of course you can pauze/continue when you are playing, by calling <em>stop() / doContinue()</em>, and you can determine if it is currently playing using the <em>isPlaying</em>-getter.</p><p>These are all the public functions.</p><div class="bbCSH" style="font-family: monospace;"> <span style="color: #808080; font-style: italic;">/// Constructor</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> Chain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></p><p><span style="color: #808080; font-style: italic;">/// Adds a function at a specified interval (in milliseconds).</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>func:<span style="color: #000000; ">Function</span>, delay:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:Chain</p><p><span style="color: #808080; font-style: italic;">/// Start playing the sequence and calling functions</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span>repeatCount:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></p><p><span style="color: #808080; font-style: italic;">/// Start playing the sequence reversed</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> playReversed<span style="color: #66cc66;">&#40;</span>repeatCount:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></p><p><span style="color: #808080; font-style: italic;">/// Clears sequence list. Data will be removed.</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Chain</p><p><span style="color: #808080; font-style: italic;">/// Stop playing, use doContinue to play futher from current point</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></p><p><span style="color: #808080; font-style: italic;">/// Continue playing after a stop</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> doContinue<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:Chain</p><p><span style="color: #808080; font-style: italic;">/// Reset indexes</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> reset<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></p><p><span style="color: #808080; font-style: italic;">/// Returns the string representation of the Chain private vars.</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span></p><p><span style="color: #808080; font-style: italic;">/// Return chain is playing, stopped or completed</span><br /> <span style="color: #b1b100;">public</span> <span style="color: #000000; ">function</span> <span style="color: #0066CC;">get</span> isPlaying<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Boolean</span><br /> &nbsp;</div><p>Hope you like it, let me know if you like to see extra/other related features.</p><p><strong>Download: <a href="http://code.google.com/p/stroep/source/browse/#svn%2Ftrunk%2Fflashsources%2Fchain%2Fnl%2Fstroep%2Fchain">Chain</a></strong> (googlecode)</p><p><strong>Updates</strong><br /> - Private functions are protected<br /> - <em>add</em>-functions is now add(function, delay), where function is required.<br /> - Class now extends EventDispatcher and <em>play/playReversed</em> dispatches <em>Event.COMPLETE</em> after playing sequence, instead of calling onComplete function<br /> - Cleaned up code</p><p><a href="http://blog.stroep.nl/?flattrss_redirect&amp;id=824&amp;md5=71d5697f23fd8fd96a893254237ce37e" title="Flattr" target="_blank"><img src="http://blog.stroep.nl/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded> <wfw:commentRss>http://blog.stroep.nl/2009/11/delayed-function-calling-chain/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Stroep @ Googlecode</title><link>http://blog.stroep.nl/2009/06/stroep-googlecode/</link> <comments>http://blog.stroep.nl/2009/06/stroep-googlecode/#comments</comments> <pubDate>Thu, 04 Jun 2009 19:33:32 +0000</pubDate> <dc:creator>Mark Knol</dc:creator> <category><![CDATA[actionscript]]></category> <category><![CDATA[Code snippets]]></category> <category><![CDATA[code]]></category> <category><![CDATA[google]]></category> <category><![CDATA[googlecode]]></category><guid isPermaLink="false">http://blog.stroep.nl/?p=647</guid> <description><![CDATA[<img src="http://blog.stroep.nl/wp-content/googlecode.jpg" alt="" title="googlecode" width="100" height="100" class="alignleft size-full wp-image-652" />Today I created a <a href="http://code.google.com/">googlecode </a>account. Now I can easily share code with you guys. :)<strong>check it out</strong> <a href="http://code.google.com/p/stroep/">http://code.google.com/p/stroep/</a> ..or directly go to the source: <a href="http://code.google.com/p/stroep/source/browse/">http://code.google.com/p/stroep/source/browse/</a>]]></description> <content:encoded><![CDATA[<p><img src="http://blog.stroep.nl/wp-content/googlecode.jpg" alt="" title="googlecode" width="100" height="100" class="alignleft size-full wp-image-652" />Today I created a <a href="http://code.google.com/">googlecode </a>account. Now I can easily share actionscript classes with you guys <img src='http://blog.stroep.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p><strong>check it out</strong><br /> <a href="http://code.google.com/p/stroep/">http://code.google.com/p/stroep/</a><br /> ..or directly go to the source:<br /> <a href="http://code.google.com/p/stroep/source/browse/">http://code.google.com/p/stroep/source/browse/</a></p> ]]></content:encoded> <wfw:commentRss>http://blog.stroep.nl/2009/06/stroep-googlecode/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
