Created
December 3, 2010 01:12
-
-
Save torus/726418 to your computer and use it in GitHub Desktop.
A Tween replacement to avoid getting GC-ed during playing a tween.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import fl.transitions.Tween; | |
import flash.utils.*; | |
public class SafeTween { | |
var tw : Tween; | |
public function SafeTween (obj:Object, prop:String, func:Function, | |
begin:Number, finish:Number, | |
duration:Number, useSeconds:Boolean = false) { | |
tw = new Tween (obj, prop, func, begin, finish, duration, useSeconds); | |
var intid = setInterval (function () { | |
if (! tw.isPlaying) { | |
clearInterval (intid); | |
} | |
}, 100); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment