<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Bug in AS3 Tween Class</title>
	<atom:link href="http://alvinzhang.info/index.php?feed=rss2&#038;p=4" rel="self" type="application/rss+xml" />
	<link>http://alvinzhang.info/?p=4</link>
	<description>Experimentation and everything fun about the web.</description>
	<lastBuildDate>Thu, 09 Sep 2010 22:17:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Marcello Romani</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-19544</link>
		<dc:creator>Marcello Romani</dc:creator>
		<pubDate>Thu, 02 Sep 2010 19:06:03 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-19544</guid>
		<description>Hi, thanks for the post and the comments.
I edited a bit the TweenManager code. The created tweens are automatically deleted when they end.

HTH


package {
    
    /*
     * Hold a reference to tweens so GC doesn&#039;t collect them too early.
     */
    
    import fl.transitions.*;
    import fl.transitions.easing.*;


    final public class TweenManager {
        
        static private var __tweens:Array = new Array();

        // var t:Tween = TweenManager.create( /* usual Tween params */ );
        static public function create(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean=true):Tween {
            var tween:Tween = new Tween(obj, prop, func, begin, finish, duration, useSeconds);
            TweenManager.__tweens.push(tween);
            
            trace(&quot;TweenManager: created tween&quot;);
            
            tween.addEventListener(TweenEvent.MOTION_FINISH, autoRemoveTween);
            
            return tween;
        }
        
        
        static private function autoRemoveTween(e:TweenEvent) {
            trace(&quot;TweenManager: autoremove&quot;);
            TweenManager.remove(e.target as Tween);
        }


        static public function remove(tween:Tween):void {
            for(var k in TweenManager.__tweens) {
                if(TweenManager.__tweens[k] === tween) {
                    tween = null;
                    TweenManager.__tweens[k] = null;
                    
                    trace(&quot;TweenManager: destroyed tween&quot;);
                    
                    return;
                }
            }
        }
    }
}</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the post and the comments.<br />
I edited a bit the TweenManager code. The created tweens are automatically deleted when they end.</p>
<p>HTH</p>
<p>package {</p>
<p>    /*<br />
     * Hold a reference to tweens so GC doesn&#8217;t collect them too early.<br />
     */</p>
<p>    import fl.transitions.*;<br />
    import fl.transitions.easing.*;</p>
<p>    final public class TweenManager {</p>
<p>        static private var __tweens:Array = new Array();</p>
<p>        // var t:Tween = TweenManager.create( /* usual Tween params */ );<br />
        static public function create(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean=true):Tween {<br />
            var tween:Tween = new Tween(obj, prop, func, begin, finish, duration, useSeconds);<br />
            TweenManager.__tweens.push(tween);</p>
<p>            trace(&#8221;TweenManager: created tween&#8221;);</p>
<p>            tween.addEventListener(TweenEvent.MOTION_FINISH, autoRemoveTween);</p>
<p>            return tween;<br />
        }</p>
<p>        static private function autoRemoveTween(e:TweenEvent) {<br />
            trace(&#8221;TweenManager: autoremove&#8221;);<br />
            TweenManager.remove(e.target as Tween);<br />
        }</p>
<p>        static public function remove(tween:Tween):void {<br />
            for(var k in TweenManager.__tweens) {<br />
                if(TweenManager.__tweens[k] === tween) {<br />
                    tween = null;<br />
                    TweenManager.__tweens[k] = null;</p>
<p>                    trace(&#8221;TweenManager: destroyed tween&#8221;);</p>
<p>                    return;<br />
                }<br />
            }<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mouse control</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-19525</link>
		<dc:creator>mouse control</dc:creator>
		<pubDate>Mon, 26 Jul 2010 18:48:11 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-19525</guid>
		<description>Doing a bit of web surfing and observed your weblog appears to be like somewhat screwed up in my K-meleon web browser. However , fortunately hardly anyone makes use of it any more however you may want to look into it.</description>
		<content:encoded><![CDATA[<p>Doing a bit of web surfing and observed your weblog appears to be like somewhat screwed up in my K-meleon web browser. However , fortunately hardly anyone makes use of it any more however you may want to look into it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: electronfusion</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-17243</link>
		<dc:creator>electronfusion</dc:creator>
		<pubDate>Thu, 29 Apr 2010 23:43:13 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-17243</guid>
		<description>Yep. i&#039;ve found two different bugs so far in CS4&#039;s tweening.

in one movie, AFTER publishing my swf file, the tweens randomly stop at different points within each run of that same file.

in another movie, the swf file runs consistently, and the bug gets introduced BEFORE publishing the swf file. if i select and then deselect a shape (without performing any other action besides selecting and deselecting onscreen), then publish the file, it will stop at a different point than in the last swf file i exported.

my conclusion: there is a bug in how flash cs4 exports .flash files with tweens to .swf files, AND in how both the FLASH cs4 and FLASHPLAYER cs4 applications handle .swf files with tweens. I haven&#039;t checked these in a web browser just yet. hopefully the flash pug-in is less buggy.

my work-around: I&#039; going to write my own tween class. Might publish the code on my website soon, for those interested.</description>
		<content:encoded><![CDATA[<p>Yep. i&#8217;ve found two different bugs so far in CS4&#8217;s tweening.</p>
<p>in one movie, AFTER publishing my swf file, the tweens randomly stop at different points within each run of that same file.</p>
<p>in another movie, the swf file runs consistently, and the bug gets introduced BEFORE publishing the swf file. if i select and then deselect a shape (without performing any other action besides selecting and deselecting onscreen), then publish the file, it will stop at a different point than in the last swf file i exported.</p>
<p>my conclusion: there is a bug in how flash cs4 exports .flash files with tweens to .swf files, AND in how both the FLASH cs4 and FLASHPLAYER cs4 applications handle .swf files with tweens. I haven&#8217;t checked these in a web browser just yet. hopefully the flash pug-in is less buggy.</p>
<p>my work-around: I&#8217; going to write my own tween class. Might publish the code on my website soon, for those interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maulsmash</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-10006</link>
		<dc:creator>Maulsmash</dc:creator>
		<pubDate>Wed, 18 Nov 2009 19:38:33 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-10006</guid>
		<description>I&#039;ve been having the same issue...using tweens for roll over and roll out mouse events and randomly a tween will freeze. I tried various methods global variables, housing the tweens in an array and also a Dictionary, and i even tried Tweenlite (which doesn&#039;t work well with rollovers...even with overwrite manager).  Still the issue persists...is there any real workaround? The thing is it is so inconsistant that is bugs me more...any help is appreciated. Thank you.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been having the same issue&#8230;using tweens for roll over and roll out mouse events and randomly a tween will freeze. I tried various methods global variables, housing the tweens in an array and also a Dictionary, and i even tried Tweenlite (which doesn&#8217;t work well with rollovers&#8230;even with overwrite manager).  Still the issue persists&#8230;is there any real workaround? The thing is it is so inconsistant that is bugs me more&#8230;any help is appreciated. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pensan</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-7887</link>
		<dc:creator>pensan</dc:creator>
		<pubDate>Fri, 04 Sep 2009 11:56:58 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-7887</guid>
		<description>hi there,
we got a simple solution for this kind of problem.

We just pushed the new Tween object into an Array.

example:
myArray.push(new Tween(...params...))

the tween is immedeatly executed when pushed into the array.

greetings pensan &amp; a fellow student</description>
		<content:encoded><![CDATA[<p>hi there,<br />
we got a simple solution for this kind of problem.</p>
<p>We just pushed the new Tween object into an Array.</p>
<p>example:<br />
myArray.push(new Tween(&#8230;params&#8230;))</p>
<p>the tween is immedeatly executed when pushed into the array.</p>
<p>greetings pensan &amp; a fellow student</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flash file review - GlowHost Web Hosting Forums</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-7568</link>
		<dc:creator>Flash file review - GlowHost Web Hosting Forums</dc:creator>
		<pubDate>Fri, 14 Aug 2009 03:34:53 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-7568</guid>
		<description>[...] found this post: Bug in AS3 Tween Class Flash + Photoshop + Everything Cool! about a bug in AS3 that is driving a few people crazy! Thought I would post the solution for others [...]</description>
		<content:encoded><![CDATA[<p>[...] found this post: Bug in AS3 Tween Class Flash + Photoshop + Everything Cool! about a bug in AS3 that is driving a few people crazy! Thought I would post the solution for others [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carl von Buelow</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-6974</link>
		<dc:creator>Carl von Buelow</dc:creator>
		<pubDate>Tue, 14 Jul 2009 18:09:35 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-6974</guid>
		<description>declaring the tweens globally worked for me. thanks!
carl (::)</description>
		<content:encoded><![CDATA[<p>declaring the tweens globally worked for me. thanks!<br />
carl (::)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-2452</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Fri, 23 Jan 2009 03:42:01 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-2452</guid>
		<description>Cam-

Thanks for the solution! I was looking at alternative way to solve the Tween class in AS3.
Much appreciation
Frank</description>
		<content:encoded><![CDATA[<p>Cam-</p>
<p>Thanks for the solution! I was looking at alternative way to solve the Tween class in AS3.<br />
Much appreciation<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cam</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-2433</link>
		<dc:creator>Cam</dc:creator>
		<pubDate>Mon, 19 Jan 2009 02:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-2433</guid>
		<description>So I just ran into this problem also, and created a very quick, down and dirty, fix by storing the tweens in an array:

var tweens:Array = new Array();

function create_tween(){
  tweens[tween_count] = new Tween( whatever tween settings );
  tween_count++;
}

add an Motion_finish event listener so u can remove it when its done, or whatever else u want to do with it.

Since the tween is references by the array, garbage collection wont be deleting it before its done its job.</description>
		<content:encoded><![CDATA[<p>So I just ran into this problem also, and created a very quick, down and dirty, fix by storing the tweens in an array:</p>
<p>var tweens:Array = new Array();</p>
<p>function create_tween(){<br />
  tweens[tween_count] = new Tween( whatever tween settings );<br />
  tween_count++;<br />
}</p>
<p>add an Motion_finish event listener so u can remove it when its done, or whatever else u want to do with it.</p>
<p>Since the tween is references by the array, garbage collection wont be deleting it before its done its job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Chartier</title>
		<link>http://alvinzhang.info/?p=4&#038;cpage=1#comment-2250</link>
		<dc:creator>Jonathan Chartier</dc:creator>
		<pubDate>Sat, 20 Dec 2008 22:35:36 +0000</pubDate>
		<guid isPermaLink="false">http://alvinzhang.info/?p=4#comment-2250</guid>
		<description>Hi. I found this and is work for me. I got 21 tween in same time.

http://www.scottgmorgan.com/blog/index.php/2007/11/18/as3-garbage-collection-the-reason-your-tweens-are-ending-early/

Just use private var.</description>
		<content:encoded><![CDATA[<p>Hi. I found this and is work for me. I got 21 tween in same time.</p>
<p><a href="http://www.scottgmorgan.com/blog/index.php/2007/11/18/as3-garbage-collection-the-reason-your-tweens-are-ending-early/" rel="nofollow">http://www.scottgmorgan.com/blog/index.php/2007/11/18/as3-garbage-collection-the-reason-your-tweens-are-ending-early/</a></p>
<p>Just use private var.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
