How would I go about converting this new AS3 frameForward plugin to work with AS2? I've had a go with the following but it doesn't seem to actually do anything? Any advice would be gratefully received!
Thanks,
Dan
class com.greensock.plugins.FrameForwardPlugin extends TweenPlugin {
/** @private **/
public static var API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
/** @private **/
private var _start:Number;
/** @private **/
private var _change:Number;
/** @private **/
private var _max:Number;
/** @private **/
private var _target:MovieClip;
/** @private Allows FrameBackwardPlugin to extend this class and only use an extremely small amount of kb (because the functionality is combined here) **/
private var _backward:Boolean;
/** @private **/
public function FrameForwardPlugin() {
super();
this.propName = "frameForward";
this.overwriteProps = ["frame","frameLabel","frameForward","frameBackward"];
this.round = true;
}
/** @private **/
public function onInitTween(target:Object, value:Object, tween:TweenLite):Boolean {
if (typeof(target) != "movieclip" || isNaN(value)) {
return false;
}
_target = MovieClip(target);
_start = _target.currentFrame;
_max = _target.totalFrames;
_change = (typeof(value) == "number") ? Number(value) - _start : Number(value);
if (!_backward && _change < 0) {
_change += _max;
} else if (_backward && _change > 0) {
_change -= _max;
}
return true;
}
/** @private **/
public function set changeFactor(n:Number){
var frame:Number = (_start + (_change * n)) % _max;
if (frame < 0.5 && frame >= -0.5) {
frame = _max;
} else if (frame < 0) {
frame += _max;
}
_target.gotoAndStop( int(frame + 0.5) );
}
}