Skip to content

Instantly share code, notes, and snippets.

@torus
Created December 3, 2010 01:12
Show Gist options
  • Save torus/726418 to your computer and use it in GitHub Desktop.
Save torus/726418 to your computer and use it in GitHub Desktop.
A Tween replacement to avoid getting GC-ed during playing a tween.
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