Laco Tween Redux

Clasificado bajo: AS2 (deprecated) — drus @ 8:23 pm

Si viera esto Laco probablemente me cortaría la coleta, pero el otro día estaba ajustando el peso de unas creatividades y no tuve más remedio que sacar Kb de donde no había eliminando los métodos que no me resultaban extrictamente necesarios de la clase "tween" de Laco. Esto fue lo que quedo.

Actionscript:
if (_global.$tweenManager == undefined) {
    _global.$tweenManager = new zigo.tweenManager();
} else {
    _global.$tweenManager.playing = false;
}
var Mp = MovieClip.prototype;
Mp.addListener = function() {
    if (!this._listeners) {
        AsBroadcaster.initialize(this);
    }
    this.addListener.apply(this, arguments);
};
ASSetPropFlags(Mp, "addListener", 1, 0);
// == core methods ==
Mp.tween = function(props, pEnd, seconds, animType, delay, callback, extra1, extra2) {
    if (typeof (props) == "string") {
        props = [props];
    }
    if (pEnd.length == undefined) {
        pEnd = [pEnd];
    }
    // parse animtype to reference to equation function               
    switch (typeof (animType)) {
    case "string" :
        //string
        animType = animType.toLowerCase();
        if (eqf == undefined) {
            // set default tweening equation
            var eqf = com.robertpenner.easing.Expo.easeInOut;
        }
        break;
    case "function" :
        // function
        var eqf = animType;
        break;
    case "object" :
        // object from custom easing
        if (animType.ease != undefined && animType.pts != undefined) {
            var eqf = animType.ease;
            extra1 = animType.pts;
        } else {
            var eqf = com.robertpenner.easing.Expo.easeInOut;
        }
        break;
    default :
        var eqf = com.robertpenner.easing.Expo.easeInOut;
    }
    // parse callback function
    if (_global.$tweenManager.autoStop) {
        // automatic removing tweens as in Zeh proto
        _global.$tweenManager.removeTween(this, props);
    }
    if (delay>0) {
        _global.$tweenManager.addTweenWithDelay(delay, this, props, pEnd, seconds, eqf, callback, extra1, extra2);
    } else {
        _global.$tweenManager.addTween(this, props, pEnd, seconds, eqf, callback, extra1, extra2);
    }
};
ASSetPropFlags(Mp, "tween", 1, 0);
delete Mp;

Muy criticable, lo sé, debi hacerme mi propia versión pero el tiempo es el que hay, y al igual que con los Kb, lo acabas sacando de donde no hay.




AS_toolKit | Powered by WordPress | Skinned by Drus Unlimited | RSS Feed | Copyleft